Thrift:TNonblockingServer的链接错误

用了thrift的TNonblockingServer。在链接的时候,报错:??/tmp/ccXs15pD.o: In function `main':/opt/proj/workspace0/buddy/src/main.cpp:147: undefined reference to `apache::thrift::server...

用了thrift的TNonblockingServer。在链接的时候,报错:

?

?

/tmp/ccXs15pD.o: In function `main':/opt/proj/workspace0/buddy/src/main.cpp:147: undefined reference to `apache::thrift::server::TNonblockingServer::serve()'/tmp/ccXs15pD.o: In function `~TNonblockingServer':/usr/local/include/thrift/server/TNonblockingServer.h:246: undefined reference to `vtable for apache::thrift::server::TNonblockingServer'/usr/local/include/thrift/server/TNonblockingServer.h:246: undefined reference to `vtable for apache::thrift::server::TNonblockingServer'collect2: ld returned 1 exit status

原因:没有把libthriftnb.so链进去

解决方法:

1、把-l thriftnb加到编译参数里面,注意要放到代码后面

2、1不行,看看lib库搜索路径下有没有libthriftnb.so。如果没有看看libevent装了没,没有的话就装上,然后重新make install一下thrift


转自:http://server.it-cto.com/webserver/apache/2011/0903/2543.html

你可能感兴趣的:(Thrift:TNonblockingServer的链接错误)