问题编译thrift 0.9.0 c ++客户端

时间:2013-07-09 14:57:04

标签: c++ ubuntu thrift

我尝试在ubuntu exact32:

上使用thrift 0.9.0编译cpp应用程序
g++ hello_client.cpp gen-cpp/HelloSvc.cpp -lthrift

然而,这导致:

In file included from /usr/local/include/thrift/transport/TSocket.h:25:0,
                 from hello_client.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:107:3: error: 'uint32_t' does not name a type
...

1 个答案:

答案 0 :(得分:1)

我试图修复0.9.0:

1)安装python-dev(我注意到一个错误:在构建thrift时缺少python.h)

sudo apt-get install python-dev

2)建立节俭:

./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"

仍然是同样的错误,所以我决定结帐,构建和安装最新的节俭(HEAD版本6f2a5037105ccad05eb84ec0a60da3389c85eb3f在git中)。

使用最新的thrift,构建cpp客户端没有错误。但是,运行a.out会返回错误:

./a.out: error while loading shared libraries: libthrift-1.0.0-dev.so: cannot open 
         shared object file: No such file or directory

将LD_LIBRARY_PATH设置为新构建的thrift库,修复此问题:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$THRIFT_SRC/lib/cpp/.libs/