/bin/sh: pkg-config: command not found - c++

I'm trying to run hand gesture recognition openCV sample project from this link https://github.com/simena86/handDetectionCV. I run the make command in cygwin terminal, but i'm getting error. I run following command in cygwin terminal E:\handDetectionCVmaster\make
Output:
Arun#Arun-PC /cygdrive/e/handDetectionCVmaster
$ make
g++ -o opencv main.cpp myImage.cpp handGesture.cpp roi.cpp `pkg-config --cflags --libs opencv`
/bin/sh: pkg-config: command not found
main.cpp:1:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory
main.cpp:2:29: error: opencv2/opencv.hpp: No such file or directory
main.cpp:3:39: error: opencv2/highgui/highgui.hpp: No such file or directory
In file included from main.cpp:8:
myImage.hpp:8: error: 'cv' is not a namespace-name
myImage.hpp:8: error: expected namespace-name before ';' token
myImage.hpp:15: error: 'Mat' does not name a type
myImage.hpp:16: error: 'Mat' does not name a type
myImage.hpp:17: error: 'Mat' does not name a type
myImage.hpp:18: error: 'Mat' was not declared in this scope
myImage.hpp:18: error: template argument 1 is invalid
myImage.hpp:18: error: template argument 2 is invalid
myImage.hpp:19: error: 'VideoCapture' does not name a type
In file included from main.cpp:9:
roi.hpp:9: error: 'cv' is not a namespace-name
roi.hpp:9: error: expected namespace-name before ';' token
roi.hpp:14: error: expected ')' before 'upper_corner'
roi.hpp:15: error: 'Point' does not name a type
roi.hpp:16: error: 'Mat' does not name a type
roi.hpp:17: error: 'Scalar' does not name a type
roi.hpp:19: error: 'Mat' has not been declared
In file included from main.cpp:10:
handGesture.hpp:11: error: 'cv' is not a namespace-name
handGesture.hpp:11: error: expected namespace-name before ';' token
handGesture.hpp:18: error: 'Point' was not declared in this scope
handGesture.hpp:18: error: template argument 1 is invalid
handGesture.hpp:18: error: template argument 2 is invalid
handGesture.hpp:18: error: template argument 1 is invalid
handGesture.hpp:18: error: template argument 2 is invalid
handGesture.hpp:20: error: 'Point' was not declared in this scope
handGesture.hpp:20: error: template argument 1 is invalid
handGesture.hpp:20: error: template argument 2 is invalid
handGesture.hpp:20: error: template argument 1 is invalid
handGesture.hpp:20: error: template argument 2 is invalid
handGesture.hpp:21: error: 'Vec4i' was not declared in this scope
handGesture.hpp:21: error: template argument 1 is invalid
handGesture.hpp:21: error: template argument 2 is invalid
handGesture.hpp:21: error: template argument 1 is invalid
handGesture.hpp:21: error: template argument 2 is invalid
handGesture.hpp:22: error: 'Point' was not declared in this scope
handGesture.hpp:22: error: template argument 1 is invalid
handGesture.hpp:22: error: template argument 2 is invalid
handGesture.hpp:23: error: 'Rect' does not name a type
handGesture.hpp:24: error: 'Mat' has not been declared
handGesture.hpp:29: error: 'Rect' does not name a type
handGesture.hpp:44: error: 'Point' has not been declared
handGesture.hpp:44: error: 'Point' has not been declared
handGesture.hpp:44: error: 'Point' has not been declared
handGesture.hpp:53: error: 'Scalar' does not name a type
handGesture.hpp:55: error: 'Point' has not been declared
handGesture.hpp:55: error: 'Point' has not been declared
handGesture.hpp:56: error: 'Vec4i' was not declared in this scope
handGesture.hpp:56: error: template argument 1 is invalid
handGesture.hpp:56: error: template argument 2 is invalid
main.cpp:15: error: 'cv' is not a namespace-name
main.cpp:15: error: expected namespace-name before ';' token
main.cpp:19: error: 'FONT_HERSHEY_PLAIN' was not declared in this scope

That means you miss the pkg-config installation. That is what is also causing the rest of the errors as the output of the pkg-config command could not be invoked, respectively.
Go to the following url, grab it and install it:
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip
Please note that you might need to install further dependencies from that site, but then it oughta work, basically.

Related

can't compile QtPdfium using Mingw32 QT 5.12 to read PDF

I want to extract text from PDF so I tried QPdfium From here
I tried to compile the library using QT 5.12.0 with Mingw32 compiler I followed this steps:
1 - I git a clone from the project and then open the qtpdfium.pro, select release mode with Mingw 32 compiler.
2 - when i start to build I got around 18 Error
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fsdk_actionhandler.cpp:425: error: 'class CPDF_Dest' has no member named 'GetObjectW'; did you mean 'GetObject'?
const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:447: error: 'g_pdfium_print_postscript_level' was not declared in this scope
g_pdfium_print_postscript_level = postscript_level;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fsdk_actionhandler.cpp:425: error: 'class CPDF_Dest' has no member named 'GetObjectW'; did you mean 'GetObject'?
const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: no matching function for call to 'MakeUnique<<expression error> >(HDC__*&)'
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: template argument 1 is invalid
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: template argument 1 is invalid
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: template argument 1 is invalid
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:688: error: 'CFX_WindowsDevice' was not declared in this scope
CFX_WindowsDevice WinDC(dc);
^~~~~~~~~~~~~~~~~
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:689: error: 'WinDC' was not declared in this scope
if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
^~~~~
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:447: error: 'g_pdfium_print_postscript_level' was not declared in this scope
g_pdfium_print_postscript_level = postscript_level;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: 'CFX_WindowsDevice' was not declared in this scope
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^~~~~~~~~~~~~~~~~
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: no matching function for call to 'MakeUnique<<expression error> >(HDC__*&)'
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: template argument 1 is invalid
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: template argument 1 is invalid
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:681: error: template argument 1 is invalid
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:688: error: 'CFX_WindowsDevice' was not declared in this scope
CFX_WindowsDevice WinDC(dc);
^~~~~~~~~~~~~~~~~
D:\build\qtpdfium-master\src\3rdparty\pdfium\fpdfsdk\fpdfview.cpp:689: error: 'WinDC' was not declared in this scope
if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
^~~~~
so what is the problem, in the readme file It say that I can compile it with no problem, I tried to compile using MSVC 2017 32 and it give me more errors 187 errors, so please any help if some one compiled it before, or if there any link to download the library in a binary instead of compiling it.
Thanks in advance.

error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type

I'm trying to compile the lib ARvrml (From ARToolKit. See the source here) on Ubuntu and get this:
g++ -c -I../../../include -I/usr/local/include/openvrml -I/usr/X11R6/include -O -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml2 -I/usr/X11R6/include arViewer.cpp -o arViewer.o
In file included from arViewer.cpp:37:0:
arViewer.h:74:12: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.h:85:13: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.h:90:13: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.h:97:13: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.cpp: In constructor ‘arVrmlBrowser::arVrmlBrowser()’:
arViewer.cpp:41:71: error: no matching function for call to ‘openvrml::browser::browser(std::ostream&, std::ostream&)’
arViewer.cpp:41:71: note: candidates are:
/usr/local/include/openvrml/openvrml/browser.h:284:9: note: openvrml::browser::browser(openvrml::resource_fetcher&, std::ostream&, std::ostream&)
/usr/local/include/openvrml/openvrml/browser.h:284:9: note: candidate expects 3 arguments, 2 provided
/usr/local/include/openvrml/openvrml/browser.h:195:24: note: openvrml::browser::browser(openvrml::browser&)
/usr/local/include/openvrml/openvrml/browser.h:195:24: note: candidate expects 1 argument, 2 provided
arViewer.cpp: At global scope:
arViewer.cpp:269:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
arViewer.cpp:283:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
arViewer.cpp:292:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
arViewer.cpp:305:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
make: *** [arViewer.o] Error 1
Considering that ARToolkit (without VRML support) is working well and OpenVRML is installed successfully, I can't figure out what is the problem here.

Symbian C++ stdint seamingly random errors

I am trying to compile the PyS60USB for Pys60 2.0 with the Symbian Belle Sdk but for some seemingly unrelated reason I am getting the seemingly random errors about almost everything not naming a type, like these:
*
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:38: error: '__int8_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:43: error: '__int16_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:48: error: '__int32_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:53: error: '__int64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:58: error: '__uint8_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:63: error: '__uint16_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:68: error: '__uint32_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:73: error: '__uint64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:77: error: '__int_least8_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:78: error: '__int_least16_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:79: error: '__int_least32_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:80: error: '__int_least64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:82: error: '__uint_least8_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:83: error: '__uint_least16_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:84: error: '__uint_least32_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:85: error: '__uint_least64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:87: error: '__int_fast8_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:88: error: '__int_fast16_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:89: error: '__int_fast32_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:90: error: '__int_fast64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:92: error: '__uint_fast8_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:93: error: '__uint_fast16_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:94: error: '__uint_fast32_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:95: error: '__uint_fast64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:97: error: '__intmax_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:98: error: '__uintmax_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:101: error: '__intptr_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/stdint.h:102: error: '__uintptr_t' does not name a type*
I also get other errors like these:
*
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/python25/pyport.h:90: error: 'uintptr_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/python25/pyport.h:91: error: 'intptr_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/python25/pyport.h:116: error: 'Py_intptr_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/_sigset.h:51: error: '__uint64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/_timeval.h:35: error: '__suseconds_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/_timeval.h:40: error: '__time_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/_timeval.h:47: error: redefinition of 'struct timeval'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/libc/sys/time.h:30: error: previous definition of 'struct timeval'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/select.h:45: error: conflicting declaration 'typedef __fd_mask fd_mask'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/libc/sys/types.h:89: error: 'fd_mask' has a previous declaration as 'typedef long int fd_mask'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/select.h:50: error: '__uint64_t' does not name a type
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/select.h:72: error: redefinition of 'struct fd_set'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/libc/sys/types.h:97: error: previous definition of 'struct fd_set'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/select.h:74: error: invalid type in declaration before ';' token
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/stdapis/sys/select.h:74: error: conflicting declaration 'typedef int fd_set'
C:/Nokia/Devices/Nokia_Symbian_Belle_SDK_v1.0/epoc32/include/libc/sys/types.h:99: error: 'fd_set' has a previous declaration as 'typedef struct fd_set fd_set'*
ETC...
I am guessing these errors are probably related and are probably caused by some problem with my environment or something. Do any of you have any I idea what could possibly causing all these hundreds of errors?
Looks like you have two incompatible C standard library implementations in your include path. There's the old ESTLIB in epoc32/include/libc and the newer Open C epoc32/include/stdapis. Remove the former from your MMP file include paths. While there, check that you are not linking against estlib.lib.
Disclaimer: It's been a couple of years since I last time touched a Symbian SDK.

Compiling C++ Thrift code to interface Cassandra results in following errors. What are we missing here?

$ g++ -lthrift -Wall thriftfs.cpp cassandra_constants.cpp Cassandra.cpp cassandra_types.cpp -o thriftfs -I/usr/local/include/thrift -L/usr/local/lib
In file included from /usr/local/include/thrift/protocol/TProtocol.h:23:0,
from /usr/local/include/thrift/TProcessor.h:24,
from Cassandra.h:10,
from t`enter code here`hriftfs.cpp:4:
/usr/local/include/thrift/transport/TTransport.h:34:1: error: ‘uint32_t’ does not name a type
/usr/local/include/thrift/transport/TTransport.h:156:29: error: ISO C++ forbids declaration of ‘buf’ with no type [-fpermissive]
In file included from /usr/local/include/thrift/TProcessor.h:24:0,
from Cassandra.h:10,
from thriftfs.cpp:4:
/usr/local/include/thrift/protocol/TProtocol.h:184:1: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:10:0,
from thriftfs.cpp:4:
/usr/local/include/thrift/TProcessor.h:72:57: error: ‘uint32_t’ has not been declared
In file included from cassandra_types.h:11:0,
from Cassandra.h:11,
from thriftfs.cpp:4:
/usr/local/include/thrift/TApplicationException.h:94:3: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:85:16: error: ‘uint8_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:142:3: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:1478:16: error: ‘uint8_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:1812:3: error: ‘uint32_t’ does not name a type
In file included from thriftfs.cpp:4:0:
Cassandra.h:217:3: error: ‘uint32_t’ does not name a type
Cassandra.h:4857:35: error: ‘org::apache::thrift’ has not been declared
Cassandra.h:4857:62: error: expected ‘,’ or ‘...’ before ‘*’ token
Cassandra.h:4859:71: error: cannot declare pointer to ‘void’ member
Cassandra.h:4859:145: error: template argument 2 is invalid
Cassandra.h:4859:145: error: template argument 4 is invalid
Cassandra.h:4860:45: error: ‘org::apache::thrift’ has not been declared
Cassandra.h:4860:72: error: expected ‘,’ or ‘...’ before ‘*’ token
Cassandra.h:4935:42: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:42: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:42: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:42: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:77: error: template argument 1 is invalid
Cassandra.h:4935:105: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:105: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:105: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:105: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:140: error: template argument 1 is invalid
Cassandra.h: In constructor ‘org::apache::cassandra::CassandraProcessor::CassandraProcessor(boost::shared_ptr)’:
Cassandra.h:4898:49: error: assignment of read-only location ‘"login"[((org::apache::cassandra::CassandraProcessor*)this)->org::apache::cassandra::CassandraProcessor::processMap_]’
Cassandra.h:4898:49: error: cannot convert ‘void (org::apache::cassandra::CassandraProcessor::*)(int32_t, int) {aka void (org::apach
Add the following defines:
g++ -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H ...
Or add #include <stdint.h> before including Thrift.h in your code.
See the discussion at THRIFT-1326. The issue is suppposedly fixed in thrift 0.9.
It looks like your problem is a compiler issue.
It can't find the type "uint32_t"
There is another question on SO regarding this:
'uint32_t' identifier not found error
Quoted from user templatetypedef
This type is defined in the C header which is not currently
a part of the C++ standard. According to the Wikipedia page on the
header, it hasn't shipped with Visual Studio until VS2010.
In the meantime, you could probably fake up your own version of the
header by adding typedefs that map Microsoft's custom integer types to
the types expected by C. For example:
typedef __int32 int32_t; typedef unsigned __int32 uint32_t; /* ...
etc. ... */ Hope this helps!

GCC 4.1.2 compilation error for stl_vector.h

I am getting the following error for STL files on GCC 4.1.2. And the same code works properly without any compilation errors on GCC 3.4.6.
I am including some built-in headers in my code that in turn include these STL files. Hence, I cannot modify the header files.
I compile it using the following:
gcc -I/grid/0/gs/java/jdk64/current/include -I/grid/0/gs/java/jdk64/current/include/linux -I/grid/0/tmp/direct/include/ydmg/ ydmg.cpp -I/grid/0/tmp/direct/include/ -o libydmg.so
Do I need to include some other parameter while compiling?
Could the compiler version be the cause of this problem?
The error is as follows:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:157: error: expected type-specifier
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:157: error: expected `>'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:157: error: expected unqualified-id before â>â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:932: error: expected â,â or â...â before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:932: error: âbool ytl::std::operator==(int)â must have an argument of class or enumerated type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:932: error: âbool ytl::std::operator==(int)â must take exactly two arguments
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: In function âbool ytl::std::operator==(int)â:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:933: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:933: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:934: error: âequalâ is not a member of âytl::stdâ
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:949: error: expected â,â or â...â before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:949: error: âbool ytl::std::operator<(int)â must have an argument of class or enumerated type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:949: error: âbool ytl::std::operator<(int)â must take exactly two arguments
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: In function âbool ytl::std::operator<(int)â:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:950: error: âlexicographical_compareâ is not a member of âytl::stdâ
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:950: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:951: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:956: error: expected â,â or â...â before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:956: error: âbool ytl::std::operator!=(int)â must have an argument of class or enumerated type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:956: error: âbool ytl::std::operator!=(int)â must take exactly two arguments
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: In function âbool ytl::std::operator!=(int)â:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:957: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:957: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:962: error: expected â,â or â...â before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:962: error: âbool ytl::std::operator>(int)â must have an argument of class or enumerated type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:962: error: âbool ytl::std::operator>(int)â must take exactly two arguments
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: In function âbool ytl::std::operator>(int)â:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:963: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:963: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:968: error: expected â,â or â...â before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:968: error: âbool ytl::std::operator<=(int)â must have an argument of class or enumerated type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:968: error: âbool ytl::std::operator<=(int)â must take exactly two arguments
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: In function âbool ytl::std::operator<=(int)â:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:969: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:969: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:974: error: expected â,â or â...â before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:974: error: âbool ytl::std::operator>=(int)â must have an argument of class or enumerated type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:974: error: âbool ytl::std::operator>=(int)â must take exactly two arguments
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: In function âbool ytl::std::operator>=(int)â:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:975: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:975: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: variable or field âswapâ declared void
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: âytl::std::swapâ declared as an âinlineâ variable
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: template declaration of âint ytl::std::swapâ
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: âvectorâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: expected primary-expression before â,â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: expected primary-expression before â>â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: â__xâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: âvectorâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: expected primary-expression before â,â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: expected primary-expression before â>â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:980: error: â__yâ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h:110: error: expected template-name before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h:110: error: expected `{' before â<â token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h:110: error: expected unqualified-id before â<â token
Any help would be appreciated.
Here is the C++ code.
I am calling the methods from ydmg and yut libraries using JNI.
This code is working perfectly fine on gcc 3.4.6. Its gives errors on gcc 4.1.2.
#include <stdio.h>
#include "ydmg/bd.h"
#include <jni.h>
#include "yut/string.h"
extern "C" int getAge();
JNIEXPORT jint JNICALL Java_ydmgBd_getAge(JNIEnv *, jobject)
{
ydmgBd bdObject;
yutString s = bdObject.getKeys();
printf("\ngetKeys() returns the key as : %s",s.c_str());
yutHash user;
yutString value = "abc";
yutString key ="login";
user.set(key,value);
ydmgBd bd1(user);
bool val = bd1.save(user);
if(val){
printf("\ntrue");
}else {
printf("\nfalse");
}
int age = bd1.getAge();
printf("\nAge : %d ",age);
printf("\nhi");
return 1;
}
int main(){
return 0;
}
If you compile cpp code with gcc and not with g++, you must link with -lstdc++, so that option is definitely missing.
However, the problem already occurs at the parsing step, so my suggestion is to check the namespaces... e.g. have a look at the error output:
...
ytl::std::operator!=
...
std should not be in your personal ytl namespace. You are doing something wrong with your includes.
One of your header files is almost certainly including:
#include <vector>
Before that line, add:
#undef max
And I believe your compiles will start working. This is happening b/c you are also using the C std library, which for some functions uses macros, and in this case, causes the preprocessor to freak out. I've seen this same error on Linux, and undefining that symbol was all i needed to get things compiling again.