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

标签 c++ ubuntu thrift

我尝试在 ubuntu precise32 上用 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
...

最佳答案

我尝试通过以下方式修复 0.9.0:

1) 安装 python-dev (我注意到一个错误: missing python.h when building thrift)

sudo apt-get install python-dev

2) Thrift :

./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"

仍然是同样的错误,所以我决定检查、构建和安装最新的 thrift(git 中的 HEAD 版本 6f2a5037105ccad05eb84ec0a60da3389c85eb3f)。

使用最新的 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 库修复了这个问题:

导出 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$THRIFT_SRC/lib/cpp/.libs/

关于c++ - 问题编译 thrift 0.9.0 c++ 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17551531/

相关文章:

php - 在 Ubuntu 终端中运行 PHP 时不会收到警告

java - Thrift 列表的序列化(反序列化)

c++ - 在 Windows 中编译 Apache Thrift 服务

c++ - 需要帮助空运行,不知道输出是这样的

c++ - 如何有效地使用 std::async 对指针数组执行操作

C++,向上箭头检测为向上和向右

c++ - 成功进行 SSL 通信的要求

c++ - 显示系列和输入位数,如果...输入 n=900,则输出将为 1 4 9 25 49 121 169 289 361 529 841 并且计数 =3

windows - 如何在 WSL 上使用 Redis 运行 RediSearch 模块(适用于 Linux 的 Windows 子系统)

python - 尝试从 iPython 运行脚本时出现语法错误