0

I have a problem when compiling thrift 0.9.1 cpp code.

My makefile like this:

objects = genFeaVec_multiThread_HSV.o imgIDservice_types.o ImgIDdifNameService.o

genFeaVec_multiThread_HSV_thrift : $(objects)


g++ -o genFeaVec_multiThread_HSV_thrift $(objects) -I/usr/include -L/usr/lib64 -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_video -lopencv_imgproc -lopencv_core -lthrift

the compiler g++ tells that:

g++ -o genFeaVec_multiThread_HSV_thrift genFeaVec_multiThread_HSV.o imgIDservice_types.o ImgIDdifNameService.o -I/usr/include -L/usr/lib64 -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_video -lopencv_imgproc -lopencv_core -I/usr/include/ -L/usr/lib64 -lthrift -lthriftnb -levent
undefined reference to `apache::thrift::transport::TSocket::TSocket(std::string const&, int)'

my cpp code is like this:

std::string host_i=string("localhost");
boost::shared_ptr<TTransport> socket(new TSocket(host_i,9537));

i have tried host_i.c_str() and "localhost" but it not works. And I have checked the lib -lthrift:

nm -CD /usr/lib64/libthrift-0.9.1.so | grep TSocket

`00000000000670f0 T apache::thrift::transport::TSocket::TSocket(int)
0000000000066ea0 T apache::thrift::transport::TSocket::TSocket(std::string)
0000000000066d80 T apache::thrift::transport::TSocket::TSocket(std::string, int)
0000000000066fc0 T apache::thrift::transport::TSocket::TSocket()
00000000000670f0 T apache::thrift::transport::TSocket::TSocket(int)
0000000000066ea0 T apache::thrift::transport::TSocket::TSocket(std::string)
0000000000066d80 T apache::thrift::transport::TSocket::TSocket(std::string, int)`

The include files are OK. In dir /usr/include

I think the problem is still how to import lib. But I do not know what is wrong with my makefile.

Idan
  • 5,405
  • 7
  • 35
  • 52
timruning
  • 1
  • 1

1 Answers1

0

Try the additional library : stdlib libc++ as opposed to libstdc++ and -lthrift.