Chinaunix首页 | 论坛 | 博客
  • 博客访问: 469274
  • 博文数量: 111
  • 博客积分: 2332
  • 博客等级: 大尉
  • 技术积分: 1187
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-29 11:22
文章分类

全部博文(111)

文章存档

2013年(9)

2012年(28)

2011年(17)

2010年(28)

2009年(29)

我的朋友

分类: C/C++

2013-05-31 17:41:04

把thrift 自带的cpp的例子改了一下,用来测试。因为要作为客户端部署,所以要将thrit静态编译进去。改了一下thrift例子里面的cpp文件一开始server: CppServer.cpp    g++ -o CppServer -DHAVE_NETINET_IN_H -I${THRIFT_DIR} -I${BOOST_DIR}  -L${LIB_DIR} /usr/local/lib/libthrift.a /usr/local/lib/libthriftnb.a /usr/local/lib/libthriftz.a CppServer.cpp ${GEN_SRC}总是报一大堆的错误,如:g++ -o CppServer -fPIC -DHAVE_NETINET_IN_H -I/usr/local/include/thrift -I/usr/local/boost/include/boost-1_33_1/  -L/usr/local/lib /usr/local/lib/libthrift.a /usr/local/lib/libthriftnb.a /usr/local/lib/libthriftz.a server.cpp WatchProxy.cpp watchproxy_types.cpp watchproxy_constants.cpp/tmp/ccLZYHik.o: In function `main':server.cpp:(.text+0x1de): undefined reference to `apache::thrift::transport::TServerSocket::TServerSocket(std::basic_string)'server.cpp:(.text+0x2f0): undefined reference to `apache::thrift::server::TSimpleServer::serve()'/tmp/ccLZYHik.o: In function `apache::thrift::server::TSimpleServer::~TSimpleServer()':server.cpp:(.text._ZN6apache6thrift6server13TSimpleServerD1Ev[apache::thrift::server::TSimpleServer::~TSimpleServer()]+0xf): undefined reference to `vtable for apache::thrift::server::TSimpleServer'后来改了一下编译语句的顺序g++ -o CppServer -DHAVE_NETINET_IN_H -I${THRIFT_DIR} -I${BOOST_DIR}  server.cpp ${GEN_SRC} -L${LIB_DIR} /usr/local/lib/libthrift.a /usr/local/lib/libthriftnb.a /usr/local/lib/libthriftz.a就好了。因为我对编译方便也不懂,估计是将静态链接库文件放到前面的时候一些定义没找到,至于原因,还不清楚。
阅读(3013) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~