You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Violette Le Drogo <vl...@e-vitech.com> on 2012/01/23 16:54:18 UTC
Errors when compiling the cppClient example : "undefined reference
to ..."
Hello,
I'm new to Thrift.
I think I installed it correctly. I have the folowing libs :
-rwxr-xr-x 1 root root 5,4M 2012-01-23 16:36
/usr/local/lib/libthrift-0.8.0.so
-rw-r--r-- 1 root root 14M 2012-01-23 16:36 /usr/local/lib/libthrift.a
-rwxr-xr-x 1 root root 1000 2012-01-23 16:36 /usr/local/lib/libthrift.la
-rwxr-xr-x 1 root root 992K 2012-01-23 16:36
/usr/local/lib/libthriftnb-0.8.0.so
-rw-r--r-- 1 root root 2,4M 2012-01-23 16:36 /usr/local/lib/libthriftnb.a
-rwxr-xr-x 1 root root 1014 2012-01-23 16:36 /usr/local/lib/libthriftnb.la
lrwxrwxrwx 1 root root 20 2012-01-23 16:36
/usr/local/lib/libthriftnb.so -> libthriftnb-0.8.0.so
lrwxrwxrwx 1 root root 18 2012-01-23 16:36 /usr/local/lib/libthrift.so
-> libthrift-0.8.0.so
-rwxr-xr-x 1 root root 190K 2012-01-23 16:36
/usr/local/lib/libthriftz-0.8.0.so
-rw-r--r-- 1 root root 397K 2012-01-23 16:36 /usr/local/lib/libthriftz.a
-rwxr-xr-x 1 root root 1007 2012-01-23 16:36 /usr/local/lib/libthriftz.la
lrwxrwxrwx 1 root root 19 2012-01-23 16:36
/usr/local/lib/libthriftz.so -> libthriftz-0.8.0.so
Then I tryed to compile the cppClient tutorial but I have "undefined
reference" errors :
g++ -o CppServer -I/usr/local/include/thrift
-I/opt/evitech/elibc/current/include/boost/ -I/usr/include/netinet/
-I../gen-cpp -L/usr/local/lib/ -lthrift CppServer.cpp
../gen-cpp/SharedService.cpp ../gen-cpp/shared_types.cpp
../gen-cpp/tutorial_types.cpp ../gen-cpp/Calculator.cpp
CppServer.cpp:(.text+0xc7): undefined reference to
`apache::thrift::transport::TServerSocket::TServerSocket(int)'
CppServer.cpp:(.text+0x13b): undefined reference to
`apache::thrift::server::TSimpleServer::serve()'
/tmp/ccISdkq5.o: In function
`apache::thrift::server::TSimpleServer::~TSimpleServer()':
CppServer.cpp:(.text._ZN6apache6thrift6server13TSimpleServerD2Ev[_ZN6apache6thrift6server13TSimpleServerD5Ev]+0x13):
undefined reference to `vtable for apache::thrift::server::TSimpleServer'
/tmp/ccISdkq5.o: In function
`apache::thrift::transport::TBufferedTransport::TBufferedTransport(boost::shared_ptr<apache::thrift::transport::TTransport>)':
CppServer.cpp:(.text._ZN6apache6thrift9transport18TBufferedTransportC2EN5boost10shared_ptrINS1_10TTransportEEE[_ZN6apache6thrift9transport18TBufferedTransportC5EN5boost10shared_ptrINS1_10TTransportEEE]+0x24):
undefined reference to `vtable for
apache::thrift::transport::TBufferedTransport'
/tmp/ccISdkq5.o: In function
`apache::thrift::server::TSimpleServer::TSimpleServer<apache::thrift::TProcessor>(boost::shared_ptr<apache::thrift::TProcessor>
const&, boost::shared_ptr<apache::thrift::transport::TServerTransport>
const&, boost::shared_ptr<apache::thrift::transport::TTransportFactory>
const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>
const&,
boost::enable_if<boost::is_convertible<apache::thrift::TProcessor*,
apache::thrift::TProcessor*>::type, void*>::type)':
CppServer.cpp:(.text._ZN6apache6thrift6server13TSimpleServerC2INS0_10TProcessorEEERKN5boost10shared_ptrIT_EERKNS6_INS0_9transport16TServerTransportEEERKNS6_INSB_17TTransportFactoryEEERKNS6_INS0_8protocol16TProtocolFactoryEEENS5_9enable_ifINS5_14is_convertibleIPS7_PS4_E4typeEPvE4typeE[_ZN6apache6thrift6server13TSimpleServerC5INS0_10TProcessorEEERKN5boost10shared_ptrIT_EERKNS6_INS0_9transport16TServerTransportEEERKNS6_INSB_17TTransportFactoryEEERKNS6_INS0_8protocol16TProtocolFactoryEEENS5_9enable_ifINS5_14is_convertibleIPS7_PS4_E4typeEPvE4typeE]+0x4c):
undefined reference to `vtable for apache::thrift::server::TSimpleServer'
/tmp/ccISdkq5.o: In function
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
apache::thrift::protocol::TMessageType, int)':
CppServer.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE17writeMessageBeginERKSsNS1_12TMessageTypeEi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
apache::thrift::protocol::TMessageType, int)]+0x27): undefined reference
to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'
....
I also put these 2 lines in /usr/local/include/Thrift.h because of
htons, htonls errors :
#include <inttypes.h>
#include <netinet/in.h>
I'm on Ubuntu 11.10 with gcc 4.6.1.
Can anyone help me? Thanks and sorry for the newbie question.
Violette