thrift经常遇到的问题

thrift里自带的turoral,使用make编译时经常会报错,总结如下:

1.如果出现如下错误:

              error: ‘uint8_t’ does not name a type

                error: ‘uint32_t’ does not name a type

编译时需要加上:-DHAVE_NETINET_IN_H

如果是在cdt里编译,需要在工程配置-》C/C++ Build/Settings->Tool Settings->GCC C++ Compiler->Preprocessor->Defined Symbols(-D)中添加HAVE_NETINET_IN_H即可

2.如果出现:

 1)undefined reference to `apache::thrift::TApplicationException::write(apache::thrift::protocol::TProtocol*) const'

 2)complains about undefined reference to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'

需要修改/usr/include/thrift/protocol/TBinaryProtocol.h

中的:

static const int32_t VERSION_MASK = 0xffff0000;
static const int32_t VERSION_1 = 0x80010000

static const uint32_t VERSION_MASK = 0xffff0000;
static const uint32_t VERSION_1 = 0x80010000;

3.如果还报错:

undefined reference to `apache::thrift::transport::TServerSocket::TServerSocket等错误,需要修改makfile,把编译命令里的-lthrift挪到命令的后边,即待编译文件之后

最后,thrift的使用例程还可以参考官方的wiki:

http://wiki.apache.org/thrift/ThriftUsageC%2B%2B


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值