Can't compile wsseapi.c using gSOAP on Linux - c++

On a linux system, I want to create a client app using gSOAP-2.8.8 that interacts with a SOAP service. After exposing the WSDL file, I am unable to compile wsseapi.c.
I am using this command:
g++ -c wsseapi.c -DWITH_OPENSSL -DWITH_DOM
And it displays the following errors:
wsseapi.c: In function âint soap_wsse_add_SecurityContextToken(soap*, const char*, const char*)â:
wsseapi.c:2238: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2239: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2242: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2247: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2248: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c: In function âconst char* soap_wsse_get_SecurityContextToken(soap*)â:
wsseapi.c:2263: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2263: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2265: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c:2266: error: âstruct _wsse__Securityâ has no member named âwsc__SecurityContextTokenâ
wsseapi.c: In function âint soap_wsse_add_SignedInfo_Reference(soap*, const char*, const char*, const char*, int, const char*)â:
wsseapi.c:2312: error: declaration of C function âint soap_wsse_add_SignedInfo_Reference(soap*, const char*, const char*, const char*, int, const char*)â conflicts with
wsseapi.h:161: error: previous declaration âint soap_wsse_add_SignedInfo_Reference(soap*, const char*, const char*, const char*, const char*)â here
wsseapi.c: In function âint soap_wsse_add_SignedInfo_Reference(soap*, const char*, const char*, const char*, int, const char*)â:
wsseapi.c:2318: error: cannot convert âds__ReferenceType**â to âds__ReferenceType*â in assignment
wsseapi.c:2373: error: no match for âoperator=â in â*(signedInfo->ds__SignedInfoType::Reference + ((ds__ReferenceType*)(((long unsigned int)signedInfo->ds__SignedInfoType::__sizeReference) * 48ul))) = referenceâ
soapStub.h:296: note: candidates are: ds__ReferenceType& ds__ReferenceType::operator=(const ds__ReferenceType&)
wsseapi.c: In function âint soap_wsse_verify_SignedInfo(soap*)â:
wsseapi.c:2723: error: cannot convert âds__ReferenceTypeâ to âds__ReferenceType*â in initialization
wsseapi.c: In function âint soap_wsse_verify_digest(soap*, int, int, const char*, unsigned char*)â:
wsseapi.c:2863: error: âSOAP_WSSE_IGNORE_EXTRA_REFSâ was not declared in this scope
wsseapi.c: In function âint soap_wsse_add_SignedInfo_Reference(soap*, const char*, const char*, const char*, int, const char*)â:
wsseapi.c:3056: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3057: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3058: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3059: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c: In function âint soap_wsse_add_EncryptedKey(soap*, int, const char*, X509*, const char*, const char*, const char*)â:
wsseapi.c:3206: error: declaration of C function âint soap_wsse_add_EncryptedKey(soap*, int, const char*, X509*, const char*, const char*, const char*)â conflicts with
wsseapi.h:207: error: previous declaration âint soap_wsse_add_EncryptedKey(soap*, const char*, X509*, const char*)â here
wsseapi.c: In function âint soap_wsse_add_EncryptedKey(soap*, int, const char*, X509*, const char*, const char*, const char*)â:
wsseapi.c:3207: error: invalid conversion from âintâ to âconst char*â
wsseapi.c:3207: error: cannot convert âconst char*â to âX509*â for argument â3â to âint soap_wsse_add_EncryptedKey_encrypt_only(soap*, const char*, X509*, const char*, const char*)â
wsseapi.c: In function âint soap_wsse_add_EncryptedKey(soap*, int, const char*, X509*, const char*, const char*, const char*)â:
wsseapi.c:3250: error: declaration of C function âint soap_wsse_add_EncryptedKey_encrypt_only(soap*, int, const char*, X509*, const char*, const char*, const char*, const char*)â conflicts with
wsseapi.h:208: error: previous declaration âint soap_wsse_add_EncryptedKey_encrypt_only(soap*, const char*, X509*, const char*, const char*)â here
wsseapi.c: In function âint soap_wsse_add_EncryptedKey_encrypt_only(soap*, int, const char*, X509*, const char*, const char*, const char*, const char*)â:
wsseapi.c:3294: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3296: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3297: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3298: error: âstruct ds__X509DataTypeâ has no member named âX509IssuerSerialâ
wsseapi.c:3348: error: âstruct soap_wsse_dataâ has no member named âenco_keynameâ
wsseapi.c: In function âint soap_wsse_verify_EncryptedKey(soap*)â:
wsseapi.c:3434: error: invalid conversion from âint*â to âintâ
wsseapi.c:3445: error: invalid conversion from âint*â to âintâ
wsseapi.c:3454: error: âstruct ds__X509DataTypeâ has no member named âX509SubjectNameâ
wsseapi.c:3455: error: âstruct ds__X509DataTypeâ has no member named âX509SubjectNameâ
wsseapi.c:3458: error: invalid conversion from âint*â to âintâ
wsseapi.c: In function âint soap_wsse_add_EncryptedData_KeyInfo_KeyName(soap*, const char*)â:
wsseapi.c:3640: error: âstruct soap_wsse_dataâ has no member named âenco_keynameâ
wsseapi.c: In function âint soap_wsse_init(soap*, soap_wsse_data*, const void* (*)(soap*, int*, const char*, int*))â:
wsseapi.c:3965: error: âstruct soap_wsse_dataâ has no member named âenco_keynameâ
wsseapi.c:3979: error: invalid conversion from âconst void* (*)(soap*, int*, const char*, int*)â to âconst void* (*)(soap*, int, const char*, int*)â
wsseapi.c: In function âint soap_wsse_copy(soap*, soap_plugin*, soap_plugin*)â:
wsseapi.c:3998: error: invalid conversion from âconst void* (*)(soap*, int, const char*, int*)â to âconst void* (*)(soap*, int*, const char*, int*)â
wsseapi.c:3998: error: initializing argument 3 of âint soap_wsse_init(soap*, soap_wsse_data*, const void* (*)(soap*, int*, const char*, int*))â
wsseapi.c: In function âsize_t soap_wsse_verify_element(soap*, const char*, const char*)â:
wsseapi.c:4267: error: cannot convert âds__ReferenceTypeâ to âds__ReferenceType*â in initialization
wsseapi.c: In function âint soap_wsse_encrypt_begin(soap*, const char*, int, const char*, const char*, const unsigned char*)â:
wsseapi.c:4542: error: declaration of C function âint soap_wsse_encrypt_begin(soap*, const char*, int, const char*, const char*, const unsigned char*)â conflicts with
wsseapi.h:221: error: previous declaration âint soap_wsse_encrypt_begin(soap*, const char*, const char*, const char*, const unsigned char*)â here
wsseapi.c: In function âint soap_wsse_decrypt_begin(soap*, const unsigned char*)â:
wsseapi.c:4688: error: invalid conversion from âint*â to âintâ
wsseapi.c:4700: error: invalid conversion from âint*â to âintâ
wsseapi.c: In function âint soap_wsse_element_begin_out(soap*, const char*)â:
wsseapi.c:4852: error: âstruct soap_wsse_dataâ has no member named âenco_keynameâ
wsseapi.c:4864: error: âstruct soap_wsse_dataâ has no member named âenco_keynameâ
wsseapi.c: In function âint soap_wsse_preparefinalrecv(soap*)â:
wsseapi.c:5100: error: invalid conversion from âint*â to âintâ
wsseapi.c:5120: error: invalid conversion from âint*â to âintâ
It will be great if some one can help me to communicate with my web service using C++. I can add the link for the WSDL.

Related

How to fix malfunctioning G++ Complier?

The G++ complier is not working. Yesterday I was updating MinGW and Windows PATHS to get Natbeans working but now Visual Studio Code is not Saying "Hello World", It is giving 20+ errors each run.
Any ideas on how to fix so I can run my program? I Uninstalled and Reinstalled MinGw twice but it did not work
Some of the Errors:
required from 'class std::__cxx11::basic_string<char16_t>'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h:5677:41:
required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h:61:53:
error: no type named 'size_type' in 'struct
std::allocator_traitsstd::allocator<char16_t >'
typedef typename _Base_type::size_type size_type;
^~~~~~~~~ c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h:62:53:
error: no type named 'difference_type' in 'struct
std::allocator_traitsstd::allocator<char16_t >'
typedef typename _Base_type::difference_type difference_type;
^~~~~~~~~~~~~~~ c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h:70:23:
error: no members matching
'__gnu_cxx::__alloc_traitsstd::allocator<char16_t >::_Base_type {aka
std::allocator_traitsstd::allocator<char16_t >}::max_size' in
'__gnu_cxx::__alloc_traitsstd::allocator<char16_t >::_Base_type {aka
struct std::allocator_traitsstd::allocator<char16_t >}'
using _Base_type::max_size;
^~~~~~~~ In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:52:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\locale_classes.h:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\ios_base.h:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:42,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from test17.cpp:23: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h: In
member function 'size_t std::hashstd::__cxx11::basic_string<char16_t
::operator()(const u16string&) const': c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h:5678:42:
error: 'const u16string {aka const class
std::__cxx11::basic_string<char16_t>}' has no member named 'length'
__s.length() * sizeof(char16_t)); }
^~~~~~ In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h:40:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:52,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\locale_classes.h:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\ios_base.h:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:42,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from test17.cpp:23: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h: In
instantiation of 'struct
__gnu_cxx::__alloc_traitsstd::allocator<char32_t >': c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h:75:24:
required from 'class std::__cxx11::basic_string<char32_t>'
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h:5692:41:
required from here
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h:61:53:
error: no type named 'size_type' in 'struct
std::allocator_traitsstd::allocator<char32_t >'
typedef typename _Base_type::size_type size_type;
^~~~~~~~~ c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h:62:53:
error: no type named 'difference_type' in 'struct
std::allocator_traitsstd::allocator<char32_t >'
typedef typename _Base_type::difference_type difference_type;
^~~~~~~~~~~~~~~ c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\alloc_traits.h:70:23:
error: no members matching
'__gnu_cxx::__alloc_traitsstd::allocator<char32_t >::_Base_type {aka
std::allocator_traitsstd::allocator<char32_t >}::max_size' in
'__gnu_cxx::__alloc_traitsstd::allocator<char32_t >::_Base_type {aka
struct std::allocator_traitsstd::allocator<char32_t >}'
using _Base_type::max_size;
^~~~~~~~ In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:52:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\locale_classes.h:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\ios_base.h:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:42,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from test17.cpp:23: c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h: In
member function 'size_t std::hashstd::__cxx11::basic_string<char32_t
::operator()(const u32string&) const': c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\basic_string.h:5693:42:
error: 'const u32string {aka const class
std::__cxx11::basic_string<char32_t>}' has no member named 'length'
The Code so far (Want it to print Hello World to the Console using C++):
#include <iostream>
int main()
{
//Prints Hello World to the Console
std::cout << "Hello World" << std::endl;
}
Desired output:
"Hello World"

Unable to Build OpenCV project in eclipse CDT C++

Hello I am having issues getting my opencv setup and working with Eclipse and C++. I have my paths linked correctly and included libraries set up correctly, I have it working on my laptop so I am sure of this. When I try and build a project with just having #include as the only OpenCV code I get these errors.
UMat(UMat&& m);
^
/usr/local/include/opencv2/core/mat.hpp:2531:27: error: expected ‘,’ or ‘...’ before ‘&&’ token
UMat& operator = (UMat&& m);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: In member function ‘void cv::_InputArray::init(int, const void*, cv::Size)’:
/usr/local/include/opencv2/core/mat.inl.hpp:70:41: error: ambiguous overload for ‘operator=’ (operand types are ‘cv::Size {aka cv::Size_<int>}’ and ‘cv::Size {aka cv::Size_<int>}’)
{ flags = _flags; obj = (void*)_obj; sz = _sz; }
^
In file included from /usr/local/include/opencv2/core.hpp:58:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/types.hpp:1707:13: note: candidate: cv::Size_<_Tp>& cv::Size_<_Tp>::operator=(const cv::Size_<_Tp>&) [with _Tp = int]
Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz)
^
/usr/local/include/opencv2/core/types.hpp:1714:13: note: candidate: cv::Size_<_Tp>& cv::Size_<_Tp>::operator=(cv::Size_<_Tp>) [with _Tp = int]
Size_<_Tp>& Size_<_Tp>::operator = (Size_<_Tp>&& sz) CV_NOEXCEPT
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:88:37: error: ‘array’ in namespace ‘std’ does not name a template type
_InputArray::_InputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:88:42: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputArray::_InputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:89:86: error: ‘arr’ was not declared in this scope
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_READ, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:92:37: error: ‘array’ in namespace ‘std’ does not name a template type
_InputArray::_InputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:92:42: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputArray::_InputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputArray::_InputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:93:37: error: ‘arr’ was not declared in this scope
{ init(STD_ARRAY_MAT + ACCESS_READ, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:175:33: error: ‘cv::_OutputArray::_OutputArray’ declared as an ‘inline’ variable
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:175:33: error: ‘int cv::_OutputArray::_OutputArray’ is not a static data member of ‘class cv::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:175:33: error: template definition of non-template ‘int cv::_OutputArray::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:175:28: error: ‘array’ is not a member of ‘std’
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:175:42: error: expected primary-expression before ‘,’ token
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:175:50: error: ‘arr’ was not declared in this scope
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:33: error: ‘cv::_OutputArray::_OutputArray’ declared as an ‘inline’ variable
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:33: error: ‘int cv::_OutputArray::_OutputArray’ is not a static data member of ‘class cv::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:179:33: error: template definition of non-template ‘int cv::_OutputArray::_OutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:179:28: error: ‘array’ is not a member of ‘std’
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:42: error: expected primary-expression before ‘,’ token
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:179:50: error: ‘arr’ was not declared in this scope
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:215:39: error: ‘array’ in namespace ‘std’ does not name a template type
_OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:215:44: error: expected ‘,’ or ‘...’ before ‘<’ token
_OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:216:87: error: ‘arr’ was not declared in this scope
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:219:39: error: ‘array’ in namespace ‘std’ does not name a template type
_OutputArray::_OutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:219:44: error: expected ‘,’ or ‘...’ before ‘<’ token
_OutputArray::_OutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_OutputArray::_OutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:220:51: error: ‘arr’ was not declared in this scope
{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:290:43: error: ‘cv::_InputOutputArray::_InputOutputArray’ declared as an ‘inline’ variable
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:290:43: error: ‘int cv::_InputOutputArray::_InputOutputArray’ is not a static data member of ‘class cv::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:290:43: error: template definition of non-template ‘int cv::_InputOutputArray::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:290:38: error: ‘array’ is not a member of ‘std’
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:290:52: error: expected primary-expression before ‘,’ token
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:290:60: error: ‘arr’ was not declared in this scope
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:43: error: ‘cv::_InputOutputArray::_InputOutputArray’ declared as an ‘inline’ variable
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:43: error: ‘int cv::_InputOutputArray::_InputOutputArray’ is not a static data member of ‘class cv::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:294:43: error: template definition of non-template ‘int cv::_InputOutputArray::_InputOutputArray’
/usr/local/include/opencv2/core/mat.inl.hpp:294:38: error: ‘array’ is not a member of ‘std’
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:52: error: expected primary-expression before ‘,’ token
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:294:60: error: ‘arr’ was not declared in this scope
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:325:49: error: ‘array’ in namespace ‘std’ does not name a template type
_InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:325:54: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:326:84: error: ‘arr’ was not declared in this scope
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:329:49: error: ‘array’ in namespace ‘std’ does not name a template type
_InputOutputArray::_InputOutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp:329:54: error: expected ‘,’ or ‘...’ before ‘<’ token
_InputOutputArray::_InputOutputArray(const std::array<Mat, _Nm>& arr)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::_InputOutputArray::_InputOutputArray(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:330:48: error: ‘arr’ was not declared in this scope
{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); }
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:562:21: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
Mat::Mat(const std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:562:37: error: expected ‘,’ or ‘...’ before ‘<’ token
Mat::Mat(const std::initializer_list<_Tp> list)
^
In file included from /usr/local/include/opencv2/core.hpp:54:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::Mat::Mat(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:565:5: error: ‘list’ was not declared in this scope
CV_Assert(list.size() != 0);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:566:14: error: ‘list’ was not declared in this scope
Mat((int)list.size(), 1, traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:570:21: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
Mat::Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:570:37: error: expected ‘,’ or ‘...’ before ‘<’ token
Mat::Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::Mat::Mat(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:574:14: error: ‘s’ does not name a type
for(auto s : sizes)
^
In file included from /usr/local/include/opencv2/core.hpp:54:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected ‘;’ before ‘do’
CV_Assert(list.size() != 0);
^
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected primary-expression before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected ‘;’ before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected primary-expression before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: expected ‘)’ before ‘do’
/usr/local/include/opencv2/core/mat.inl.hpp:576:5: error: ‘list’ was not declared in this scope
CV_Assert(list.size() != 0);
^
/usr/local/include/opencv2/core/mat.inl.hpp:577:5: error: ‘list’ was not declared in this scope
CV_Assert(size_total == list.size());
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:578:14: error: ‘sizes’ was not declared in this scope
Mat((int)sizes.size(), (int*)sizes.begin(), traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
^
/usr/local/include/opencv2/core/mat.inl.hpp:578:83: error: ‘list’ was not declared in this scope
Mat((int)sizes.size(), (int*)sizes.begin(), traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:582:21: error: ‘array’ in namespace ‘std’ does not name a template type
Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
^
/usr/local/include/opencv2/core/mat.inl.hpp:582:26: error: expected ‘,’ or ‘...’ before ‘<’ token
Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In constructor ‘cv::Mat::Mat(int)’:
/usr/local/include/opencv2/core/mat.inl.hpp:583:90: error: ‘arr’ was not declared in this scope
: flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows((int)arr.size()),
^
/usr/local/include/opencv2/core/mat.inl.hpp:588:10: error: ‘copyData’ was not declared in this scope
if( !copyData )
^
/usr/local/include/opencv2/core/mat.inl.hpp: In member function ‘void cv::Mat::assignTo(cv::Mat&, int) const’:
/usr/local/include/opencv2/core/mat.inl.hpp:762:11: error: ambiguous overload for ‘operator=’ (operand types are ‘cv::Mat’ and ‘const cv::Mat’)
m = *this;
^
/usr/local/include/opencv2/core/mat.inl.hpp:686:6: note: candidate: cv::Mat& cv::Mat::operator=(const cv::Mat&)
Mat& Mat::operator = (const Mat& m)
^
In file included from /usr/local/include/opencv2/core.hpp:59:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.hpp:2060:10: note: candidate: cv::Mat& cv::Mat::operator=(cv::Mat)
Mat& operator = (Mat&& m);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:1249:20: error: ‘array’ in namespace ‘std’ does not name a template type
Mat::operator std::array<_Tp, _Nm>() const
^
/usr/local/include/opencv2/core/mat.inl.hpp:1323:13: error: expected ‘,’ or ‘...’ before ‘&&’ token
Mat::Mat(Mat&& m)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1323:1: error: prototype for ‘cv::Mat::Mat(cv::Mat)’ does not match any in class ‘cv::Mat’
Mat::Mat(Mat&& m)
^
In file included from /usr/local/include/opencv2/core.hpp:59:0,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.hpp:1021:14: error: candidates are: cv::Mat::Mat(const cv::cuda::GpuMat&)
explicit Mat(const cuda::GpuMat& m);
^
/usr/local/include/opencv2/core/mat.hpp:1018:37: error: template<class _Tp> cv::Mat::Mat(const cv::MatCommaInitializer_<_Tp>&)
template<typename _Tp> explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer);
^
/usr/local/include/opencv2/core/mat.hpp:1014:37: error: template<class _Tp> cv::Mat::Mat(const cv::Point3_<_Tp>&, bool)
template<typename _Tp> explicit Mat(const Point3_<_Tp>& pt, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:1010:37: error: template<class _Tp> cv::Mat::Mat(const cv::Point_<_Tp>&, bool)
template<typename _Tp> explicit Mat(const Point_<_Tp>& pt, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:1006:51: error: template<class _Tp, int m, int n> cv::Mat::Mat(const cv::Matx<_Tp, m, n>&, bool)
template<typename _Tp, int m, int n> explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:1002:44: error: template<class _Tp, int n> cv::Mat::Mat(const cv::Vec<_Tp, m>&, bool)
template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);
^
/usr/local/include/opencv2/core/mat.hpp:997:49: error: template<class _Tp, long unsigned int _Nm> cv::Mat::Mat(int)
template<typename _Tp, size_t _Nm> explicit Mat(const std::array<_Tp, _Nm>& arr, bool copyData=false);
^
/usr/local/include/opencv2/core/mat.hpp:992:37: error: template<class _Tp> cv::Mat::Mat(int)
template<typename _Tp> explicit Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list);
^
/usr/local/include/opencv2/core/mat.hpp:988:14: error: template<class _Tp, class> cv::Mat::Mat(int)
explicit Mat(const std::initializer_list<_Tp> list);
^
/usr/local/include/opencv2/core/mat.hpp:983:37: error: template<class _Tp> cv::Mat::Mat(const std::vector<_Tp>&, bool)
template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
^
/usr/local/include/opencv2/core/mat.hpp:965:5: error: cv::Mat::Mat(const cv::Mat&, const std::vector<cv::Range>&)
Mat(const Mat& m, const std::vector<Range>& ranges);
^
/usr/local/include/opencv2/core/mat.hpp:955:5: error: cv::Mat::Mat(const cv::Mat&, const cv::Range*)
Mat(const Mat& m, const Range* ranges);
^
/usr/local/include/opencv2/core/mat.hpp:945:5: error: cv::Mat::Mat(const cv::Mat&, const Rect&)
Mat(const Mat& m, const Rect& roi);
^
/usr/local/include/opencv2/core/mat.hpp:935:5: error: cv::Mat::Mat(const cv::Mat&, const cv::Range&, const cv::Range&)
Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all());
^
/usr/local/include/opencv2/core/mat.hpp:923:5: error: cv::Mat::Mat(const std::vector<int>&, int, void*, const size_t*)
Mat(const std::vector<int>& sizes, int type, void* data, const size_t* steps=0);
^
/usr/local/include/opencv2/core/mat.hpp:909:5: error: cv::Mat::Mat(int, const int*, int, void*, const size_t*)
Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
^
In file included from /usr/local/include/opencv2/core/mat.hpp:3657:0,
from /usr/local/include/opencv2/core.hpp:59,
from ../src/HomeworkTwo.cpp:10:
/usr/local/include/opencv2/core/mat.inl.hpp:515:1: error: cv::Mat::Mat(cv::Size, int, void*, size_t)
Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/mat.inl.hpp:486:1: error: cv::Mat::Mat(int, int, int, void*, size_t)
Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
^
/usr/local/include/opencv2/core/mat.inl.hpp:467:1: error: cv::Mat::Mat(const cv::Mat&)
Mat::Mat(const Mat& m)
^
/usr/local/include/opencv2/core/mat.inl.hpp:458:1: error: cv::Mat::Mat(const std::vector<int>&, int, const Scalar&)
Mat::Mat(const std::vector<int>& _sz, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:441:1: error: cv::Mat::Mat(int, const int*, int, const Scalar&)
Mat::Mat(int _dims, const int* _sz, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:450:1: error: cv::Mat::Mat(const std::vector<int>&, int)
Mat::Mat(const std::vector<int>& _sz, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:433:1: error: cv::Mat::Mat(int, const int*, int)
Mat::Mat(int _dims, const int* _sz, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:424:1: error: cv::Mat::Mat(cv::Size, int, const Scalar&)
Mat::Mat(Size _sz, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:407:1: error: cv::Mat::Mat(int, int, int, const Scalar&)
Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
^
/usr/local/include/opencv2/core/mat.inl.hpp:416:1: error: cv::Mat::Mat(cv::Size, int)
Mat::Mat(Size _sz, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:399:1: error: cv::Mat::Mat(int, int, int)
Mat::Mat(int _rows, int _cols, int _type)
^
/usr/local/include/opencv2/core/mat.inl.hpp:393:1: error: cv::Mat::Mat()
Mat::Mat()
^
/usr/local/include/opencv2/core/mat.inl.hpp:1348:26: error: expected ‘,’ or ‘...’ before ‘&&’ token
Mat& Mat::operator = (Mat&& m)
^
/usr/local/include/opencv2/core/mat.inl.hpp: In member function ‘cv::Mat& cv::Mat::operator=(cv::Mat)’:
/usr/local/include/opencv2/core/mat.inl.hpp:1350:18: error: ‘m’ was not declared in this scope
if (this == &m)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1354:13: error: ‘m’ was not declared in this scope
flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols; data = m.data;
^
/usr/local/include/opencv2/core/mat.inl.hpp: At global scope:
/usr/local/include/opencv2/core/mat.inl.hpp:1628:22: error: ‘cv::Mat_<_Tp>::Mat_’ declared as an ‘inline’ variable
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1628:22: error: ‘int cv::Mat_<_Tp>::Mat_’ is not a static data member of ‘class cv::Mat_<_Tp>’
/usr/local/include/opencv2/core/mat.inl.hpp:1628:22: error: template definition of non-template ‘int cv::Mat_<_Tp>::Mat_’
/usr/local/include/opencv2/core/mat.inl.hpp:1628:17: error: ‘initializer_list’ is not a member of ‘std’
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1628:42: error: expected primary-expression before ‘>’ token
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1628:44: error: ‘list’ was not declared in this scope
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
^
/usr/local/include/opencv2/core/mat.inl.hpp:1633:28: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
Mat_<_Tp>::Mat_(const std::initializer_list<int> sizes, std::initializer_list<_Tp> list)

error building simple MongoDB C++ client example

I've installed MongoDB on ubuntu 12.10, tested on the mongo shell and it works ok.
Then, i installed cxx-driver from http://dl.mongodb.org/dl/cxx-driver/
Here is a MongoDB client example that i'm trying to build:
#include <cstdlib>
#include <iostream>
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/client/dbclient.h"
#include "mongo/client/dbclientcursor.h"
#include <boost/shared_ptr.hpp>
using namespace mongo;
void run() {
DBClientConnection c;
c.connect("localhost");
boost::shared_ptr<DBClientCursor> cursor =
c.query("test", BSONObj());
while (cursor->more())
std::cout << cursor->next().toString() << std::endl;
}
int main() {
try {
run();
std::cout << "connected ok" << std::endl;
} catch( const DBException &e ) {
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
But this fails with this error:
In file included from /home/lurscher/third_party/usr/local/include/mongo/bson/oid.h:22:0,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:25,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:29,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/misc.h: In member function ‘time_t mongo::Date_t::toTimeT() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/misc.h:96:42: error: ‘verify’ was not declared in this scope
In file included from /home/lurscher/third_party/usr/local/include/mongo/util/hex.h:22:0,
from /home/lurscher/third_party/usr/local/include/mongo/bson/oid.h:23,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:25,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:29,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘void mongo::StringBuilderImpl<Allocator>::appendDoubleNice(double)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:302:28: error: there are no arguments to ‘verify’ that depend on a template parameter, so a declaration of ‘verify’ must be available [-fpermissive]
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:302:28: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:303:33: error: there are no arguments to ‘verify’ that depend on a template parameter, so a declaration of ‘verify’ must be available [-fpermissive]
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::SBNUM(T, int, const char*)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:336:28: error: there are no arguments to ‘verify’ that depend on a template parameter, so a declaration of ‘verify’ must be available [-fpermissive]
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:337:33: error: there are no arguments to ‘verify’ that depend on a template parameter, so a declaration of ‘verify’ must be available [-fpermissive]
In file included from /home/lurscher/third_party/usr/local/include/mongo/bson/oid.h:23:0,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:25,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:29,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/util/hex.h: In function ‘int mongo::fromHex(char)’:
/home/lurscher/third_party/usr/local/include/mongo/util/hex.h:33:23: error: ‘verify’ was not declared in this scope
In file included from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:29:0,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘const char* mongo::BSONElement::codeWScopeCode() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:265:70: error: ‘massert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘int mongo::BSONElement::codeWScopeCodeLen() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:272:70: error: ‘massert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘const char* mongo::BSONElement::binData(int&) const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:309:39: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘mongo::BinDataType mongo::BSONElement::binDataType() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:328:39: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘const char* mongo::BSONElement::regex() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:335:35: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘const char* mongo::BSONElement::dbrefNS() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:409:63: error: ‘uassert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘const mongo::OID& mongo::BSONElement::dbrefOID() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:414:63: error: ‘uassert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In constructor ‘mongo::BSONElement::BSONElement(const char*, int)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:439:72: error: ‘uassert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘const mongo::BSONElement& mongo::BSONElement::chk(bool) const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:477:83: error: ‘massert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h: In member function ‘int mongo::BSONElement::canonicalType() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:522:21: error: ‘verify’ was not declared in this scope
In file included from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:30:0,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobj.h: In member function ‘void mongo::BSONObj::appendSelfToBufBuilder(mongo::BufBuilder&) const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobj.h:456:31: error: ‘verify’ was not declared in this scope
In file included from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:31:0,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonmisc.h: At global scope:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonmisc.h:173:9: error: ‘auto_ptr’ in namespace ‘std’ does not name a type
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonmisc.h: In member function ‘bool mongo::BSONObjBuilderValueStream::haveSubobj() const’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonmisc.h:171:42: error: ‘_subobj’ was not declared in this scope
In file included from test_mongo.cpp:3:0:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘virtual mongo::BSONObjBuilder& mongo::BSONObjBuilder::append(const mongo::BSONElement&)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:124:30: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘virtual mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendAs(const mongo::BSONElement&, const mongo::StringData&)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:131:30: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendObject(const mongo::StringData&, const char*, int)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:148:29: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘virtual mongo::BSONObj mongo::BSONObjBuilder::obj()’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:554:65: error: ‘massert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘char* mongo::BSONObjBuilder::decouple(int&)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:589:23: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘mongo::Labeler mongo::BSONObjBuilder::operator<<(const mongo::Labeler::Label&)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:629:74: error: ‘massert’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h: In member function ‘void mongo::BSONArrayBuilder::fill(int)’:
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:836:102: error: ‘uassert’ was not declared in this scope
In file included from /home/lurscher/third_party/usr/local/include/mongo/db/jsobj.h:41:0,
from /home/lurscher/third_party/usr/local/include/mongo/client/authentication_table.h:23,
from /home/lurscher/third_party/usr/local/include/mongo/client/dbclientinterface.h:26,
from /home/lurscher/third_party/usr/local/include/mongo/client/connpool.h:23,
from /home/lurscher/third_party/usr/local/include/mongo/client/dbclient.h:32,
from test_mongo.cpp:4:
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h: In member function ‘void mongo::BSONObjBuilderValueStream::endField(const char*)’:
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:359:9: error: ‘_subobj’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h: In member function ‘mongo::BSONObjBuilder* mongo::BSONObjBuilderValueStream::subobj()’:
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:365:13: error: ‘_subobj’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:366:16: error: ‘_subobj’ was not declared in this scope
test_mongo.cpp: In function ‘void run()’:
test_mongo.cpp:15:28: error: conversion from ‘std::auto_ptr<mongo::DBClientCursor>’ to non-scalar type ‘boost::shared_ptr<mongo::DBClientCursor>’ requested
In file included from /home/lurscher/third_party/usr/local/include/mongo/util/hex.h:22:0,
from /home/lurscher/third_party/usr/local/include/mongo/bson/oid.h:23,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:25,
from /home/lurscher/third_party/usr/local/include/mongo/bson/bsonobjbuilder.h:29,
from test_mongo.cpp:3:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘void mongo::StringBuilderImpl<Allocator>::appendDoubleNice(double) [with Allocator = mongo::TrivialAllocator]’:
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:702:42: instantiated from here
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:302:13: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::SBNUM(T, int, const char*) [with T = int, Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:272:53: instantiated from ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::operator<<(int) [with Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’
/home/lurscher/third_party/usr/local/include/mongo/bson/bsonelement.h:469:64: instantiated from here
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:336:13: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::SBNUM(T, int, const char*) [with T = unsigned int, Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:275:53: instantiated from ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::operator<<(unsigned int) [with Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:493:66: instantiated from here
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:336:13: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::SBNUM(T, int, const char*) [with T = long long int, Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:284:55: instantiated from ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::operator<<(long long int) [with Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:693:50: instantiated from here
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:336:13: error: ‘verify’ was not declared in this scope
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h: In member function ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::SBNUM(T, int, const char*) [with T = long long unsigned int, Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’:
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:287:55: instantiated from ‘mongo::StringBuilderImpl<Allocator>& mongo::StringBuilderImpl<Allocator>::operator<<(long long unsigned int) [with Allocator = mongo::TrivialAllocator, mongo::StringBuilderImpl<Allocator> = mongo::StringBuilderImpl<mongo::TrivialAllocator>]’
/home/lurscher/third_party/usr/local/include/mongo/db/../bson/bson-inl.h:776:48: instantiated from here
/home/lurscher/third_party/usr/local/include/mongo/bson/util/builder.h:336:13: error: ‘verify’ was not declared in this scope
Try this...
#include <cstdlib>
#include <iostream>
#include "mongo/client/dbclient.h"
using namespace mongo;
void run() {
mongo::DBClientConnection c;
c.connect("localhost");
auto_ptr<DBClientCursor> cursor = c.query("test.test", BSONObj());
while (cursor->more())
std::cout << cursor->next().toString() << std::endl;
}
int main() {
try {
run();
std::cout << "connected ok" << std::endl;
} catch( const DBException &e ) {
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
They can be compiled using...
g++ test.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system -o test
The reason for your code's not working is the order of your includes. You just have to put dbclient.h in front of the the mongo includes. Actually, you only need dbclient.h, as it includes all other necessary headers.
What you additionally need to get this working with a shared_ptr, is a cast, for DBClientConnection::query()returns a std::auto_ptr.
The code below should work fine:
#include "mongo/client/dbclient.h"
using namespace mongo;
void run() {
DBClientConnection c;
c.connect("localhost");
boost::shared_ptr<DBClientCursor> cursor =
(boost::shared_ptr<DBClientCursor>) c.query("test", BSONObj());
while (cursor->more())
std::cout << cursor->next().toString() << std::endl;
}
int main() {
try {
run();
std::cout << "connected ok" << std::endl;
} catch( const DBException &e ) {
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}

C++: Thread Building Blocks - include hell

I can't get my C++ program to compile. As you can see, I'm writing a Node.js addon. Here is the code (Eamorr_addon.cpp):
#include <iostream>
#include <v8.h>
#include <node.h>
#include <gmp.h>
#include "Definitions.h"
#include "Rk.h"
#include "tbb/concurrent_hash_map.h"
//#include <tbb/concurrent_vector.h>
using namespace std;
using namespace v8;
static Handle<Value> Echo(const Arguments& args) {
HandleScope scope;
if (args.Length() < 1) {
return ThrowException(Exception::TypeError(String::New("Bad argument")));
}
return scope.Close(args[0]);
}
extern "C" void init (Handle<Object> target)
{
HandleScope scope;
target->Set(String::New("hello"), String::New("world"));
NODE_SET_METHOD(target, "echo", Echo);
}
Everything works just fine when I remove the line #include "tbb/concurrent_hash_map.h".
Here is my gyp make file:
{
'targets': [
{
'target_name':'Eamorr_addon',
'sources':['src/Eamorr_addon.cpp'],
'include_dirs': ['/usr/include','/usr/local/include/'],
'cflags': ['-Wall','-fopenmp'],
'ldflags': ['-ltbb','-lgmp']
}
]
}
When I do node-gyp build, I get the following stream of errors which I can't get to the bottom of:
node-gyp build
info it worked if it ends with ok
spawn make [ 'BUILDTYPE=Release', '-f', 'Makefile.gyp' ]
CXX(target) out/Release/obj.target/DeDuplicator_addon/src/DeDuplicator_addon.o
In file included from /usr/include/tbb/concurrent_hash_map.h:51:0,
from src/DeDuplicator_addon.cpp:17:
/usr/include/tbb/atomic.h:218:31: error: expected nested-name-specifier before numeric constant
/usr/include/tbb/atomic.h:218:31: error: expected ‘>’ before numeric constant
/usr/include/tbb/atomic.h:224:33: error: expected ‘)’ before ‘addend’
/usr/include/tbb/atomic.h:224:40: error: ISO C++ forbids initialization of member ‘fetch_and_add’
/usr/include/tbb/atomic.h:224:40: error: making ‘fetch_and_add’ static
/usr/include/tbb/atomic.h:224:40: error: template declaration of ‘value_type tbb::internal::fetch_and_add’
In file included from /usr/include/tbb/concurrent_hash_map.h:51:0,
from src/DeDuplicator_addon.cpp:17:
/usr/include/tbb/atomic.h:228:31: error: expected identifier before numeric constant
/usr/include/tbb/atomic.h:228:31: error: expected ‘,’ or ‘...’ before numeric constant
/usr/include/tbb/atomic.h:251:28: error: expected identifier before numeric constant
/usr/include/tbb/atomic.h:251:28: error: expected ‘,’ or ‘...’ before numeric constant
/usr/include/tbb/atomic.h:255:28: error: expected identifier before numeric constant
/usr/include/tbb/atomic.h:255:28: error: expected ‘,’ or ‘...’ before numeric constant
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::fetch_and_add(int)’:
/usr/include/tbb/atomic.h:229:48: error: ‘addend’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::fetch_and_decrement()’:
/usr/include/tbb/atomic.h:243:33: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:243:33: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:243:33: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::fetch_and_decrement()’:
/usr/include/tbb/atomic.h:247:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:247:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:247:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator+=(int)’:
/usr/include/tbb/atomic.h:252:30: error: ‘addend’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator-=(int)’:
/usr/include/tbb/atomic.h:258:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:258:32: error: ‘addend’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator--()’:
/usr/include/tbb/atomic.h:266:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:266:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:266:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator--(int)’:
/usr/include/tbb/atomic.h:274:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:274:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h:274:30: error: ‘2’ cannot be used as a function
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:329:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘long long int tbb::atomic<long long int>::operator=(long long int)’:
/usr/include/tbb/atomic.h:329:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long long int>& tbb::atomic<long long int>::operator=(const tbb::atomic<long long int>&)’:
/usr/include/tbb/atomic.h:329:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:330:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘long long unsigned int tbb::atomic<long long unsigned int>::operator=(long long unsigned int)’:
/usr/include/tbb/atomic.h:330:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long long unsigned int>& tbb::atomic<long long unsigned int>::operator=(const tbb::atomic<long long unsigned int>&)’:
/usr/include/tbb/atomic.h:330:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:335:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘long int tbb::atomic<long int>::operator=(long int)’:
/usr/include/tbb/atomic.h:335:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long int>& tbb::atomic<long int>::operator=(const tbb::atomic<long int>&)’:
/usr/include/tbb/atomic.h:335:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:336:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘long unsigned int tbb::atomic<long unsigned int>::operator=(long unsigned int)’:
/usr/include/tbb/atomic.h:336:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long unsigned int>& tbb::atomic<long unsigned int>::operator=(const tbb::atomic<long unsigned int>&)’:
/usr/include/tbb/atomic.h:336:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:352:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘unsigned int tbb::atomic<unsigned int>::operator=(unsigned int)’:
/usr/include/tbb/atomic.h:352:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<unsigned int>& tbb::atomic<unsigned int>::operator=(const tbb::atomic<unsigned int>&)’:
/usr/include/tbb/atomic.h:352:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:353:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘int tbb::atomic<int>::operator=(int)’:
/usr/include/tbb/atomic.h:353:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<int>& tbb::atomic<int>::operator=(const tbb::atomic<int>&)’:
/usr/include/tbb/atomic.h:353:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:356:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘short unsigned int tbb::atomic<short unsigned int>::operator=(short unsigned int)’:
/usr/include/tbb/atomic.h:356:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<short unsigned int>& tbb::atomic<short unsigned int>::operator=(const tbb::atomic<short unsigned int>&)’:
/usr/include/tbb/atomic.h:356:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:357:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘short int tbb::atomic<short int>::operator=(short int)’:
/usr/include/tbb/atomic.h:357:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<short int>& tbb::atomic<short int>::operator=(const tbb::atomic<short int>&)’:
/usr/include/tbb/atomic.h:357:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:358:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘char tbb::atomic<char>::operator=(char)’:
/usr/include/tbb/atomic.h:358:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<char>& tbb::atomic<char>::operator=(const tbb::atomic<char>&)’:
/usr/include/tbb/atomic.h:358:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:359:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘signed char tbb::atomic<signed char>::operator=(signed char)’:
/usr/include/tbb/atomic.h:359:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<signed char>& tbb::atomic<signed char>::operator=(const tbb::atomic<signed char>&)’:
/usr/include/tbb/atomic.h:359:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:360:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘unsigned char tbb::atomic<unsigned char>::operator=(unsigned char)’:
/usr/include/tbb/atomic.h:360:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<unsigned char>& tbb::atomic<unsigned char>::operator=(const tbb::atomic<unsigned char>&)’:
/usr/include/tbb/atomic.h:360:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:363:1: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
/usr/include/tbb/atomic.h: In member function ‘wchar_t tbb::atomic<wchar_t>::operator=(wchar_t)’:
/usr/include/tbb/atomic.h:363:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<wchar_t>& tbb::atomic<wchar_t>::operator=(const tbb::atomic<wchar_t>&)’:
/usr/include/tbb/atomic.h:363:1: error: ‘store_with_release’ was not declared in this scope
/usr/include/tbb/atomic.h: At global scope:
/usr/include/tbb/atomic.h:367:93: error: wrong number of template arguments (3, should be 2)
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’
In file included from src/DeDuplicator_addon.cpp:17:0:
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::internal::hash_map_base::check_mask_race(tbb::interface4::internal::hash_map_base::hashcode_t, tbb::interface4::internal::hash_map_base::hashcode_t&) const’:
/usr/include/tbb/concurrent_hash_map.h:266:21: error: cannot convert ‘const tbb::atomic<long unsigned int>’ to ‘tbb::interface4::internal::hash_map_base::hashcode_t’ in assignment
/usr/include/tbb/concurrent_hash_map.h: In member function ‘tbb::interface4::internal::hash_map_base::segment_index_t tbb::interface4::internal::hash_map_base::insert_new_node(tbb::interface4::internal::hash_map_base::bucket*, tbb::interface4::internal::hash_map_base::node_base*, tbb::interface4::internal::hash_map_base::hashcode_t)’:
/usr/include/tbb/concurrent_hash_map.h:296:30: error: no match for ‘operator++’ in ‘++((tbb::interface4::internal::hash_map_base*)this)->tbb::interface4::internal::hash_map_base::my_size’
/usr/include/tbb/concurrent_hash_map.h: In member function ‘void tbb::interface4::internal::hash_map_base::reserve(tbb::interface4::internal::hash_map_base::size_type)’:
/usr/include/tbb/concurrent_hash_map.h:316:32: error: no match for ‘operator!’ in ‘!((tbb::interface4::internal::hash_map_base*)this)->tbb::interface4::internal::hash_map_base::my_size’
/usr/include/tbb/concurrent_hash_map.h:316:32: note: candidate is: operator!(bool) <built-in>
/usr/include/tbb/concurrent_hash_map.h:317:32: error: cannot convert ‘tbb::atomic<long unsigned int>’ to ‘tbb::interface4::internal::hash_map_base::size_type’ in initialization
/usr/include/tbb/concurrent_hash_map.h:317:58: error: cannot convert ‘tbb::atomic<long unsigned int>’ to ‘tbb::interface4::internal::hash_map_base::size_type’ in assignment
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::empty() const’:
/usr/include/tbb/concurrent_hash_map.h:833:44: error: no match for ‘operator==’ in ‘((const tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_size == 0’
/usr/include/tbb/concurrent_hash_map.h: In member function ‘tbb::interface4::concurrent_hash_map::size_type tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::bucket_count() const’:
/usr/include/tbb/concurrent_hash_map.h:839:53: error: no match for ‘operator+’ in ‘((const tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_mask + 1’
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::exclude(tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::const_accessor&, bool)’:
/usr/include/tbb/concurrent_hash_map.h:1119:16: error: no ‘operator--(int)’ declared for postfix ‘--’
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::erase(const Key&)’:
/usr/include/tbb/concurrent_hash_map.h:1160:16: error: no ‘operator--(int)’ declared for postfix ‘--’
/usr/include/tbb/concurrent_hash_map.h: In member function ‘void tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::internal_copy(const tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>&)’:
/usr/include/tbb/concurrent_hash_map.h:1310:20: error: no match for ‘operator==’ in ‘((tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_mask == mask’
/usr/include/tbb/concurrent_hash_map.h:1323:19: error: no match for ‘operator++’ in ‘++((tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_size’
/usr/include/tbb/concurrent_hash_map.h: In member function ‘void tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::internal_copy(I, I)’:
/usr/include/tbb/concurrent_hash_map.h:1340:11: error: no match for ‘operator++’ in ‘++((tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_size’
make: *** [out/Release/obj.target/DeDuplicator_addon/src/DeDuplicator_addon.o] Error 1
ERR! Error: `make` failed with exit code: 2
at Array.0 (/usr/local/lib/node_modules/node-gyp/lib/build.js:118:25)
at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok
Can anyone suggest anything?
Edit:
Here is "Rk.h":
#ifndef RK_H_
#define RK_H_
#include <gmp.h>
#include "Definitions.h"
unsigned long int init_rkHash(char* str);
unsigned long int get_rkHash(unsigned long int prevHash,int prevAscii,int topAscii);
/*unsigned long int getFirstPrevHash(char* &buffer);*/
#endif /* RK_H_ */
and here is "Definitions.h":
#ifndef DEFINITIONS_H_
#define DEFINITIONS_H_
#define PORT 10002
#define CHUNKSIZE 512
#define PRIME 9223372036854775783
#define D 2
#endif /* DEFINITIONS_H_ */
#define macros are easy to use wrong. And giving them names like D calls for problems.
You defined D as
#define D 2
Now, if we look at atomic.h, we find e.g.
...
template<typename I, typename D, typename StepType>
struct atomic_impl_with_arithmetic: atomic_impl<I> {
...
value_type fetch_and_add( D addend ) {
...
template<memory_semantics M>
value_type fetch_and_decrement() {
return fetch_and_add<M>(__TBB_MINUS_ONE(D));
}
...
See the correlation?
What you get is:
...
template<typename I, typename 2, typename StepType>
struct atomic_impl_with_arithmetic: atomic_impl<I> {
...
value_type fetch_and_add( 2 addend ) {
...
template<memory_semantics M>
value_type fetch_and_decrement() {
return fetch_and_add<M>(__TBB_MINUS_ONE(2));
}
...
This is not valid C++.
Solution: Don't give macros a name that will probably clash. Rule of thumb: Every neat name clashes at least once in a lifetime and produce subtle and unreal error messages that might infect a poor maintainers (you?) nightly dreams with visions of indescribable demons. Therefore, only use macros if you absolutely must.
If D is supposed to be an integer (but who, except you, knows by that name?), you can do one of the following:
enum { D = 2 };
or
extern const int D; // in a header
const int D = 2; // in exactly one source file
or you may rethink your decision whether D needs to be constant at all and instead pass it as a parameter to your functions and classes.
Here is an excerpt from tbb/atomic.h
template<typename I, typename D, typename StepType>
struct atomic_impl_with_arithmetic: atomic_impl<I> {
public:
typedef I value_type;
template<memory_semantics M>
value_type fetch_and_add( D addend ) {
return value_type(internal::atomic_traits<sizeof(value_type),M>::fetch_and_add( &this->rep.value, addend*sizeof(StepType) ));
}
...
Now, if you substitute definition for D from Definitions.h you'll see what the issue is. In general it's a bad idea to make macro definitions with such names. If you've got too much code dependent on D you can fix the issue by undefining it befor including tbb headers, something like this:
#include "Definitions.h"
#include "Rk.h"
#pragma push_macro("D")
#undef D
#include "tbb/concurrent_hash_map.h"
#include <tbb/concurrent_vector.h>
#pragma pop_macro("D")

C++ compilation issue with <emmintrin.h> on Linux GCC

Tried google and searched here, but no luck.
I am trying to port some windows codes that use to Linux.
Then I get a huge amount of compilation errors.
All I did was
#include <emmintrin.h>
And then :
g++ -c -pipe -march=i686 -mtune=generic -O2 -pipe -D_REENTRANT -w -D__SSE__ -D__SSE2__ -D__MMX__ -I/usr/share/qt/mkspecs/linux-g++ -I. -o .obj/Test.o Test.cpp
In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/xmmintrin.h:36:0,
from /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/emmintrin.h:36,
from Test.cpp:33:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘void _mm_empty()’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:49:24: error: ‘__builtin_ia32_emms’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_cvtsi32_si64(int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:62:54: error: ‘__builtin_ia32_vec_init_v2si’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘int _mm_cvtsi64_si32(__vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:105:53: error: ‘__builtin_ia32_vec_ext_v2si’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_packs_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:144:69: error: ‘__builtin_ia32_packsswb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_packs_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:159:69: error: ‘__builtin_ia32_packssdw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_packs_pu16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:174:69: error: ‘__builtin_ia32_packuswb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpackhi_pi8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:188:70: error: ‘__builtin_ia32_punpckhbw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpackhi_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:202:70: error: ‘__builtin_ia32_punpckhwd’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpackhi_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:216:70: error: ‘__builtin_ia32_punpckhdq’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpacklo_pi8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:230:70: error: ‘__builtin_ia32_punpcklbw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpacklo_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:244:70: error: ‘__builtin_ia32_punpcklwd’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpacklo_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:258:70: error: ‘__builtin_ia32_punpckldq’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_pi8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:271:66: error: ‘__builtin_ia32_paddb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:284:66: error: ‘__builtin_ia32_paddw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:297:66: error: ‘__builtin_ia32_paddd’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_si64(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:311:66: error: ‘__builtin_ia32_paddq’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pi8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:320:67: error: ‘__builtin_ia32_paddsb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:334:67: error: ‘__builtin_ia32_paddsw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pu8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:348:68: error: ‘__builtin_ia32_paddusb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pu16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:362:68: error: ‘__builtin_ia32_paddusw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_pi8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:375:66: error: ‘__builtin_ia32_psubb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:388:66: error: ‘__builtin_ia32_psubw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:401:66: error: ‘__builtin_ia32_psubd’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_si64(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:415:66: error: ‘__builtin_ia32_psubq’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pi8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:424:67: error: ‘__builtin_ia32_psubsb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:438:67: error: ‘__builtin_ia32_psubsw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pu8(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:452:68: error: ‘__builtin_ia32_psubusb’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pu16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:466:68: error: ‘__builtin_ia32_psubusw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_madd_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:481:68: error: ‘__builtin_ia32_pmaddwd’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_mulhi_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:495:67: error: ‘__builtin_ia32_pmulhw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_mullo_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:509:67: error: ‘__builtin_ia32_pmullw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sll_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:522:68: error: ‘__builtin_ia32_psllw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_slli_pi16(__vector(2) int, int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:534:61: error: ‘__builtin_ia32_psllwi’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sll_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:547:68: error: ‘__builtin_ia32_pslld’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_slli_pi32(__vector(2) int, int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:559:61: error: ‘__builtin_ia32_pslldi’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sll_si64(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:572:68: error: ‘__builtin_ia32_psllq’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_slli_si64(__vector(2) int, int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:584:61: error: ‘__builtin_ia32_psllqi’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sra_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:597:68: error: ‘__builtin_ia32_psraw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srai_pi16(__vector(2) int, int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:609:61: error: ‘__builtin_ia32_psrawi’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sra_pi32(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:622:68: error: ‘__builtin_ia32_psrad’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srai_pi32(__vector(2) int, int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:634:61: error: ‘__builtin_ia32_psradi’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srl_pi16(__vector(2) int, __vector(2) int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:647:68: error: ‘__builtin_ia32_psrlw’ was not declared in this scope
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srli_pi16(__vector(2) int, int)’:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:659:61: error: ‘__builtin_ia32_psrlwi’ was not declared in this scope
Am I missing some compiler option here ? Or I need to include some other headers ?
I believe you need to allow SSE instructions using -msse.