我一直在关注 Thrift C++ wiki tutorial .使用 TSimpleServer 一切正常。 但是,当我尝试实现 TNonblockingServer 时,我遇到了这个错误:(
undefined reference to `apache::thrift::server::TNonblockingServer::serve()
undefined reference to `apache::thrift::server::TNonblockingServer::~TNonblockingServer()
我认为它与头文件或命名空间有关。 我正在使用以下 header :
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/concurrency/ThreadManager.h>
#include <thrift/concurrency/PosixThreadFactory.h>
#include <thrift/server/TThreadedServer.h>
#include <thrift/server/TNonblockingServer.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace ::apache::thrift::concurrency;
知道哪里出了问题吗?
最佳答案
我知道这真的是迟到的回复。 这是由于缺少 TNonblockingServer 的 libthriftnb 库。
虽然 Tsimplesever 和 TThreadedServer 在 libthrift 库中,所以它可以与您一起使用。
关于c++ - apache Thrift TNonblockingServer 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21915422/