我正在尝试用 C++ 构建一个节俭服务器,但我似乎在链接阶段遇到了问题。任何人都可以解释一下吗?
这就是我正在运行的。(请原谅我是 C++ n00b):
g++ -Wall -L/usr/local/lib user_constants.o user_types.o UserService_server.o -lthrift
这是输出
user_types.o: In function `UserCollection::read(apache::thrift::protocol::TProtocol*)':
user_types.cpp:(.text+0xaba): undefined reference to `CollectionInformation::read(apache::thrift::protocol::TProtocol*)'
user_types.o: In function `UserCollection::write(apache::thrift::protocol::TProtocol*) const':
user_types.cpp:(.text+0xca7): undefined reference to `CollectionInformation::write(apache::thrift::protocol::TProtocol*) const'
UserService_server.o: In function `UserServiceProcessor::UserServiceProcessor(boost::shared_ptr<UserServiceIf>)':
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x33): undefined reference to `vtable for UserServiceProcessor'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0xaf): undefined reference to `UserServiceProcessor::process_getById(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x136): undefined reference to `UserServiceProcessor::process_save(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x1bd): undefined reference to `UserServiceProcessor::process_destroy(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x23e): undefined reference to `UserServiceProcessor::process_search(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x2bc): undefined reference to `UserServiceProcessor::process_searchByName(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x33a): undefined reference to `UserServiceProcessor::process_searchByEmailAddress(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x3b8): undefined reference to `UserServiceProcessor::process_checkUsernameExists(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x436): undefined reference to `UserServiceProcessor::process_registerUser(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.cpp:(.text._ZN20UserServiceProcessorC2EN5boost10shared_ptrI13UserServiceIfEE[_ZN20UserServiceProcessorC5EN5boost10shared_ptrI13UserServiceIfEE]+0x4b4): undefined reference to `UserServiceProcessor::process_verifyUser(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)'
UserService_server.o: In function `apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)':
UserService_server.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE17writeMessageBeginERKSsNS1_12TMessageTypeEi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)]+0x27): undefined reference to `apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'
UserService_server.o: In function `apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)':
UserService_server.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE16readMessageBeginERSsRNS1_12TMessageTypeERi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)]+0x48): undefined reference to `apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_MASK'
UserService_server.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE16readMessageBeginERSsRNS1_12TMessageTypeERi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)]+0x53): undefined reference to `apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'
collect2: ld returned 1 exit status