项目--> C++目录--> 包含目录
选择boost包含目录,thrift包含目录,openssl包含目录;
在main中引入thrift通信要用的头文件:
#include "stdafx.h"
#include
#include
#include
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace std;
using boost::shared_ptr;
//#pragma comment(lib, "libthrift.lib")
//#pragma comment(lib, "libeay32.lib")
//#pragma comment(lib, "ssleay32.lib")
int main(int argc, char **argv)
{
boost::shared_ptr socket(new TSocket("localhost", 9090));
return 0;
}
运行有错误:
ThriftClientTest.obj : error LNK2001: 无法解析的外部符号 "public: __cdecl apache::thrift::transport::TSocket::TSocket(class std::basic_string,class std::allocator > const &,int)" (??0TSocket@transport@thrift@apache@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
不知道这是什么原因造成的?谁能帮我解答一下吗