编译 thrift 0.9.0 c++ 客户端的问题 [英] Issue compiling thrift 0.9.0 c++ client

查看:32
本文介绍了编译 thrift 0.9.0 c++ 客户端的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试在 ubuntu precision32 上使用 thrift 0.9.0 编译 cpp 应用程序:

I have tried compiling a cpp application with thrift 0.9.0 on ubuntu precise32:

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:

I tried to fix 0.9.0 by:

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

1) Install python-dev (I noticed an error: missing python.h when building thrift)

sudo apt-get install python-dev

2) 建立节俭:

./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"

仍然出现相同的错误,所以我决定检出、构建和安装最新的 thrift(在 git 中的 HEAD 版本 6f2a5037105ccad05eb84ec0a60da3389c85eb3f).

Still the same errors, so I decided to checkout, build and install the latest thrift (HEAD version 6f2a5037105ccad05eb84ec0a60da3389c85eb3f in git).

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

With the latest thrift, there were no errors building the cpp client. However, running a.out returned an error:

./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 库修复了这个问题:

Setting LD_LIBRARY_PATH to the newly built thrift library fixed this:

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

这篇关于编译 thrift 0.9.0 c++ 客户端的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆