vector equals for type <std::string> works in g++ but not in visual studio 2010 - visual-c++

#include<iostream>
#include<vector>
std::vector<std::string> vector1;
int main() {
vector1.push_back("adadad");
std::vector<std::string> vector2;
vector2.push_back("adadd");
if (vector1==vector2) {
std::cout<<"success";
} else {
vector1.swap(vector2);
vector2.clear();
vector2.push_back("adadd");
if (vector1==vector2) {
std::cout<<"success_swap";
}
}
}
Now this works in g++ but not in visual studio. The operator == doesn't work here and throws compilation error in visual studio 2010(ultimate). The same works if the vector is of a integer type.Am I missing something here ? This is not a linux native thing that they have omitted. Why there is a implementation in gcc but not in vc++ ?
The error message that it shows is:
[snip]\vc\include\xutility(2990): error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion)
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
[snip]\vc\include\exception(470): could be 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)'
[snip]\vc\include\exception(475): or 'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)'
[snip]\vc\include\exception(481): or 'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)'
[snip]\vc\include\system_error(408): or 'bool std::operator ==(const std::error_code &,const std::error_condition &)'
[snip]\vc\include\system_error(416): or 'bool std::operator ==(const std::error_condition &,const std::error_code &)'
while trying to match the argument list '(const std::basic_string<_Elem,_Traits,_Ax>, const std::basic_string<_Elem,_Traits,_Ax>)'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
[snip]\vc\include\xutility(3030) : see reference to function template instantiation 'bool std::_Equal<_InIt1,_InIt2>(_InIt1,_InIt1,_InIt2)' being compiled
with
[
_InIt1=const std::basic_string<char,std::char_traits<char>,std::allocator<char>> *,
_InIt2=std::_Vector_const_iterator<std::_Vector_val<std::string,std::allocator<std::string>>>
]
[snip]\vc\include\xutility(3051) : see reference to function template instantiation 'bool std::_Equal1<const std::basic_string<_Elem,_Traits,_Ax>*,_InIt2>(_InIt1,_InIt1,_InIt2,std::tr1::true_type)' being compiled
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>,
_InIt2=std::_Vector_const_iterator<std::_Vector_val<std::string,std::allocator<std::string>>>,
_InIt1=const std::basic_string<char,std::char_traits<char>,std::allocator<char>> *
]
[snip]\vc\include\vector(1489) : see reference to function template instantiation 'bool std::equal<std::_Vector_const_iterator<_Myvec>,std::_Vector_const_iterator<_Myvec>>(_InIt1,_InIt1,_InIt2)' being compiled
with
[
_Myvec=std::_Vector_val<std::string,std::allocator<std::string>>,
_InIt1=std::_Vector_const_iterator<std::_Vector_val<std::string,std::allocator<std::string>>>,
_InIt2=std::_Vector_const_iterator<std::_Vector_val<std::string,std::allocator<std::string>>>
]
[snip]\test\main.cpp(8) : see reference to function template instantiation 'bool std::operator ==<std::string,std::allocator<_Ty>>(const std::vector<_Ty> &,const std::vector<_Ty> &)' being compiled
with
[
_Ty=std::string
]

The error happens because in MSVC, std::string's equality operator (==) is not included by <iostream> or <vector>. You have to include <string> as well.
The key line in the message is; "error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion)"

You're probably using a really old compiler.
This works for me in MSVS 2005, which isn't that new itself.
If your compiler is C++03 compliant, it should work:
23.2.4
template <class T, class Allocator>
bool operator == ( const vector<T,Allocator>& x,
const vector<T,Allocator>& y);

Related

Error building CXX object gnuradio-runtime

I am trying to install a specific version of gnuradio (3.7.10.1). To do so I am not using Pybombs, but I try to do it from source (I am following this).
First I've cloned the github repository, then checkout the appropriate version. It worked fine until I've tried to invoke CMake and build GNU Radio:
mkdir build
cd build
cmake ../
make
During the make, after 6% done, I have the following error:
In file included from /usr/include/c++/7/type_traits:35:0,
from /usr/include/cppunit/tools/StringHelper.h:7,
from /usr/include/cppunit/TestAssert.h:8,
from /usr/include/cppunit/TestCase.h:6,
from /usr/include/cppunit/TestCaller.h:5,
from /usr/include/cppunit/extensions/HelperMacros.h:9,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/c++/7/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^~~~~
In file included from /usr/include/cppunit/TestAssert.h:8:0,
from /usr/include/cppunit/TestCase.h:6,
from /usr/include/cppunit/TestCaller.h:5,
from /usr/include/cppunit/extensions/HelperMacros.h:9,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/tools/StringHelper.h:22:15: error: ‘enable_if’ in namespace ‘std’ does not name a template type
typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x)
^~~~~~~~~
/usr/include/cppunit/tools/StringHelper.h:22:24: error: expected unqualified-id before ‘<’ token
typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x)
^
/usr/include/cppunit/tools/StringHelper.h:31:15: error: ‘enable_if’ in namespace ‘std’ does not name a template type
typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x)
^~~~~~~~~
/usr/include/cppunit/tools/StringHelper.h:31:24: error: expected unqualified-id before ‘<’ token
typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x)
In file included from /usr/include/cppunit/TestCase.h:6:0,
from /usr/include/cppunit/TestCaller.h:5,
from /usr/include/cppunit/extensions/HelperMacros.h:9,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/TestAssert.h: In static member function ‘static std::__cxx11::string CppUnit::assertion_traits<T>::toString(const T&)’:
/usr/include/cppunit/TestAssert.h:74:42: error: ‘toString’ is not a member of ‘CppUnit::StringHelper’
return CPPUNIT_NS::StringHelper::toString(x);
^~~~~~~~
In file included from /usr/include/cppunit/extensions/HelperMacros.h:9:0,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/TestCaller.h: At global scope:
/usr/include/cppunit/TestCaller.h:159:37: error: ‘std::function’ has not been declared
TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture):
^~~~~~~~
/usr/include/cppunit/TestCaller.h:159:45: error: expected ‘,’ or ‘...’ before ‘<’ token
TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture):
^
/usr/include/cppunit/TestCaller.h:200:8: error: ‘function’ in namespace ‘std’ does not name a template type
std::function<void()> m_test_function;
^~~~~~~~
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod)’:
/usr/include/cppunit/TestCaller.h:121:6: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
m_test_function( std::bind(test, m_fixture) )
^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:121:28: error: ‘bind’ is not a member of ‘std’
m_test_function( std::bind(test, m_fixture) )
^~~~
/usr/include/cppunit/TestCaller.h:121:28: note: suggested alternative: ‘find’
m_test_function( std::bind(test, m_fixture) )
^~~~
find
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod, Fixture&)’:
/usr/include/cppunit/TestCaller.h:138:6: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
m_test_function( std::bind(test, &fixture) )
^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:138:28: error: ‘bind’ is not a member of ‘std’
m_test_function( std::bind(test, &fixture) )
^~~~
/usr/include/cppunit/TestCaller.h:138:28: note: suggested alternative: ‘find’
m_test_function( std::bind(test, &fixture) )
^~~~
find
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod, Fixture*)’:
/usr/include/cppunit/TestCaller.h:155:6: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
m_test_function( std::bind(test, fixture) )
^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:155:28: error: ‘bind’ is not a member of ‘std’
m_test_function( std::bind(test, fixture) )
^~~~
/usr/include/cppunit/TestCaller.h:155:28: note: suggested alternative: ‘find’
m_test_function( std::bind(test, fixture) )
^~~~
find
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, int)’:
/usr/include/cppunit/TestCaller.h:162:17: error: ‘fixture’ was not declared in this scope
m_fixture(fixture),
^~~~~~~
/usr/include/cppunit/TestCaller.h:162:17: note: suggested alternative: ‘Fixture’
m_fixture(fixture),
^~~~~~~
Fixture
/usr/include/cppunit/TestCaller.h:163:7: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
m_test_function(test_function)
^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:163:23: error: ‘test_function’ was not declared in this scope
m_test_function(test_function)
^~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h: In member function ‘void CppUnit::TestCaller<Fixture>::runTest()’:
/usr/include/cppunit/TestCaller.h:175:7: error: there are no arguments to ‘m_test_function’ that depend on a template parameter, so a declaration of ‘m_test_function’ must be available [-fpermissive]
m_test_function();
^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:175:7: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from /usr/include/cppunit/extensions/HelperMacros.h:14:0,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/extensions/TestNamer.h: In member function ‘std::__cxx11::string CppUnit::TestNamer::getTestNameFor(const string&, const E&) const’:
/usr/include/cppunit/extensions/TestNamer.h:70:95: error: ‘toString’ is not a member of ‘CppUnit::StringHelper’
return getTestNameFor(testMethodName) + " with parameter: " + CPPUNIT_NS::StringHelper::toString(val);
^~~~~~~~
In file included from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26:0,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h: In static member function ‘static CppUnit::TestSuite* qa_fxpt::suite()’:
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:36:3: error: ‘unique_ptr’ is not a member of ‘std’
CPPUNIT_TEST_SUITE_END();
^
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:36:3: error: expected primary-expression before ‘>’ token
CPPUNIT_TEST_SUITE_END();
^
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:36:3: error: ‘guard’ was not declared in this scope
CPPUNIT_TEST_SUITE_END();
^
In file included from /usr/include/cppunit/extensions/HelperMacros.h:9:0,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/TestCaller.h: In instantiation of ‘void CppUnit::TestCaller<Fixture>::runTest() [with Fixture = qa_fxpt]’:
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:102:1: required from here
/usr/include/cppunit/TestCaller.h:175:22: error: ‘m_test_function’ was not declared in this scope
m_test_function();
~~~~~~~~~~~~~~~^~
/usr/include/cppunit/TestCaller.h:175:22: note: suggested alternative: ‘__fortify_function’
m_test_function();
~~~~~~~~~~~~~~~^~
__fortify_function
gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/build.make:62: recipe for target 'gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/math/qa_fxpt.cc.o' failed
make[2]: *** [gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/math/qa_fxpt.cc.o] Error 1
CMakeFiles/Makefile2:726: recipe for target 'gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/all' failed
make[1]: *** [gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
I am not a Linux expert and I am not very familiar to this compiler/library support. I don't really understand where the error comes from and how to correct it.
I use Ubuntu 18.04.
Coud you give me a hand on this please?
Any help would be very appreciated.
Thanks a lot.
/usr/include/c++/7/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
To resolve the above error you need to compile with -std=c++11 flag. Open CMakeLists.txt, find all occurrences or -std=c++98 and change them to -std=c++11. Then go to the build directory, remove CMakeCache.txt and rebuild
sed -i 's/-std=c++98/-std=c++11/g' CMakeLists.txt
cd build
rm CMakeCache.txt
cmake ..
make
Also as the error is in the cppunit and it's used for testing you can try disabling all tests
cd build
rm CMakeCache.txt
cmake -DENABLE_TESTING=OFF ..
make

bcrypt warnings inside of Docker

Is there some solution to get rid of this warning? Console displays it during the Docker image creating. There are a lot of topics all over the internet and no working solution. Since bcrypt js lib creators think that it's fine to not fixing it for years maybe it's possible to import something manually or anything like that.
Node.js v12
bcrypt v3
Docker v19
> bcrypt#3.0.6 install /usr/src/app/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
make: Entering directory '/usr/src/app/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
In file included from ../src/bcrypt_node.cc:1:
../../nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../../nan/nan.h:2232:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
In file included from ../../nan/nan.h:53,
from ../src/bcrypt_node.cc:1:
../src/bcrypt_node.cc: At global scope:
/root/.node-gyp/12.4.0/include/node/node.h:556:43: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
(node::addon_register_func) (regfunc), \
^
/root/.node-gyp/12.4.0/include/node/node.h:590:3: note: in expansion of macro 'NODE_MODULE_X'
NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
^~~~~~~~~~~~~
../src/bcrypt_node.cc:378:1: note: in expansion of macro 'NODE_MODULE'
NODE_MODULE(bcrypt_lib, init);
^~~~~~~~~~~
In file included from /root/.node-gyp/12.4.0/include/node/node.h:63,
from ../../nan/nan.h:53,
from ../src/bcrypt_node.cc:1:
/root/.node-gyp/12.4.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/root/.node-gyp/12.4.0/include/node/node_object_wrap.h:84:78: required from here
/root/.node-gyp/12.4.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
reinterpret_cast<Callback>(callback), type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/12.4.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]':
../../nan/nan_object_wrap.h:65:61: required from here
/root/.node-gyp/12.4.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]```
the warning is there for a reason, if you want to hide it, you have few choices
submit a fix to upstream to actually fix the code to remove the warning
hide it by submitting a fix to upstream and add -Wno-cast-function-type to gcc. it's up to maintainer to accept it.
submit a fix to upstream to add prebuilt binary for node 12 so that you won't have to compile every time (hence it won't trigger gcc to build). right now looks like only windows have prebuilt binary for node 12 (search for v72-linux)
https://github.com/kelektiv/node.bcrypt.js/releases/tag/v3.0.6
Are you able to use bycryptjs to avoid this issue?
The bycrypt entirely depends on the node version. Or you have to choose the suitable version of bycrypt or downgrade the version of bycrypt

Could not install pg module in node.js on Windows 7

I try to install pg module to Node.js using this command: npm install pg
At first I had to install Python. Then PostgreSQL 8.x, then Microsoft Visual C++. But still it I cannot do it. I have errors while compiling:
npm http GET https://registry.npmjs.org/pg
npm http 304 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/generic-pool/1.0.9
npm http 304 https://registry.npmjs.org/generic-pool/1.0.9
> pg#0.7.2 install C:\Users\Adam\node_modules\pg
> node-gyp rebuild || (exit 0)
C:\Users\Adam\node_modules\pg>node "C:\Program Files\nodejs\node_modules\npm\bin
\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
binding.cc
c:\users\adam\.node-gyp\0.8.1\src\node_object_wrap.h(57): warning C4251: 'node:
:ObjectWrap::handle_' : class 'v8::Persistent<T>' needs to have dll-interface t
o be used by clients of class 'node::ObjectWrap' [C:\Users\Adam\node_modules\pg
\build\binding.vcxproj]
with
[
T=v8::Object
]
..\src\binding.cc(83): error C2061: syntax error : identifier 'EV_P_' [C:\Users
\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(237): error C2146: syntax error : missing ';' before identifi
er 'read_watcher_' [C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(237): error C4430: missing type specifier - int assumed. Note
: C++ does not support default-int [C:\Users\Adam\node_modules\pg\build\binding
.vcxproj]
..\src\binding.cc(237): error C4430: missing type specifier - int assumed. Note
: C++ does not support default-int [C:\Users\Adam\node_modules\pg\build\binding
.vcxproj]
..\src\binding.cc(238): error C2146: syntax error : missing ';' before identifi
er 'write_watcher_' [C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(238): error C4430: missing type specifier - int assumed. Note
: C++ does not support default-int [C:\Users\Adam\node_modules\pg\build\binding
.vcxproj]
..\src\binding.cc(238): error C4430: missing type specifier - int assumed. Note
: C++ does not support default-int [C:\Users\Adam\node_modules\pg\build\binding
.vcxproj]
..\src\binding.cc(86): error C2065: 'w' : undeclared identifier [C:\Users\Adam\
node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(86): error C2227: left of '->data' must point to class/struct
/union/generic type [C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
type is ''unknown-type''
..\src\binding.cc(87): error C2065: 'revents' : undeclared identifier [C:\Users
\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(117): warning C4800: 'int' : forcing value to bool 'true' or
'false' (performance warning) [C:\Users\Adam\node_modules\pg\build\binding.vcxp
roj]
..\src\binding.cc(247): error C2065: 'read_watcher_' : undeclared identifier [C
:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(247): error C3861: 'ev_init': identifier not found [C:\Users\
Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(248): error C2065: 'read_watcher_' : undeclared identifier [C
:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(248): error C2228: left of '.data' must have class/struct/uni
on [C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
type is ''unknown-type''
..\src\binding.cc(249): error C2065: 'write_watcher_' : undeclared identifier [
C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(249): error C3861: 'ev_init': identifier not found [C:\Users\
Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(250): error C2065: 'write_watcher_' : undeclared identifier [
C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(250): error C2228: left of '.data' must have class/struct/uni
on [C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
type is ''unknown-type''
..\src\binding.cc(312): error C2065: 'EV_DEFAULT_' : undeclared identifier [C:\
Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(312): error C2065: 'write_watcher_' : undeclared identifier [
C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(312): error C3861: 'ev_io_start': identifier not found [C:\Us
ers\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(358): error C2065: 'read_watcher_' : undeclared identifier [C
:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(358): error C2065: 'EV_READ' : undeclared identifier [C:\User
s\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(358): error C3861: 'ev_io_set': identifier not found [C:\User
s\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(359): error C2065: 'write_watcher_' : undeclared identifier [
C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(359): error C2065: 'EV_WRITE' : undeclared identifier [C:\Use
rs\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(359): error C3861: 'ev_io_set': identifier not found [C:\User
s\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(384): error C2065: 'EV_ERROR' : undeclared identifier [C:\Use
rs\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(395): error C2065: 'EV_READ' : undeclared identifier [C:\User
s\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(434): error C2065: 'EV_WRITE' : undeclared identifier [C:\Use
rs\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(623): error C2065: 'EV_DEFAULT_' : undeclared identifier [C:\
Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(623): error C2065: 'write_watcher_' : undeclared identifier [
C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(623): error C3861: 'ev_io_stop': identifier not found [C:\Use
rs\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(629): error C2065: 'EV_DEFAULT_' : undeclared identifier [C:\
Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(629): error C2065: 'write_watcher_' : undeclared identifier [
C:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(629): error C3861: 'ev_io_start': identifier not found [C:\Us
ers\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(635): error C2065: 'EV_DEFAULT_' : undeclared identifier [C:\
Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(635): error C2065: 'read_watcher_' : undeclared identifier [C
:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(635): error C3861: 'ev_io_stop': identifier not found [C:\Use
rs\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(641): error C2065: 'EV_DEFAULT_' : undeclared identifier [C:\
Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(641): error C2065: 'read_watcher_' : undeclared identifier [C
:\Users\Adam\node_modules\pg\build\binding.vcxproj]
..\src\binding.cc(641): error C3861: 'ev_io_start': identifier not found [C:\Us
ers\Adam\node_modules\pg\build\binding.vcxproj]
gyp ERR! rebuild error Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msb
uild.exe` failed with exit code: 1
gyp ERR! rebuild error at ChildProcess.onExit (C:\Program Files\nodejs\node_
modules\npm\node_modules\node-gyp\lib\build.js:214:23)
gyp ERR! rebuild error at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! rebuild error at Process._handle.onexit (child_process.js:674:10)
gyp ERR! not ok
pg#0.7.2 node_modules\pg
└── generic-pool#1.0.9
Any ideas? Without this module, I cannot connect to my PostgreSQL database through Node.js.

Export struct defined in winbase.h with ATL's IDL

This is my method defined in IDL:
[id(3), helpstring("method GetBatteryStatus")]
HRESULT GetBatteryStatus([out,retval] SYSTEM_POWER_STATUS_EX2* batteryStatus);
The SYSTEM_POWER_STATUS_EX2 is a struct defined in winbase.h, and this project is a ATLSmartPhone Project, the winbase.h is from Microsoft's SDK.
When I compile the project the error are :
error MIDL2025 : syntax error : expecting a type specification near "SYSTEM_POWER_STATUS_EX2"
If I add import "winbase.h" to the top of the IDL file, the error will be:
error MIDL2003 : redefinition : size_t; error MIDL2003 : redefinition : _LARGE_INTEGER;.....
Then if I add the typedef in in IDL:
typedef[public,uuid(37DE998A-6787-415a-A191-861C315D1248),helpstring("Power Status")]
struct _SYSTEM_POWER_STATUS_EX2 {
...
...
} SYSTEM_POWER_STATUS_EX2;
The error will be:
error C2011: '_SYSTEM_POWER_STATUS_EX2' : 'struct' type redefinition.
So how can I export the SYSTEM_POWER_STATUS_EX2 struct which was defined in winbase.h with IDL?
You can write the IDL version of the SYSTEM_POWER_STATUS_EX2 in the separate IDL file and import it for MIDL only:
cpp_quote("#if 0")
import "fake.idl";
cpp_quote("#else")
cpp_quote("#include <orginial_header>")
cpp_quote("#endif")

Visual c++ 6.0: error C2065: 'PWR_CString' : undeclared identifier

This error for the following: C:\software\CATS\includes\Commun\xml_transfer.cpp(1527) : error C2065: 'PWR_CString' : undeclared identifier
CString s1; // Empty string
I did include:"stdafx.h" , "resource.h"

Resources