Open waterpeople opened 3 weeks ago
luwei@haode:~/tinyrpc/testcases$ g++ test_tinypb_server.cc ../lib/libtinyrpc.a -o test_tinypb_server -lprotobuf -ltinyxml -lpthread -ldl /usr/bin/ld: /tmp/cckIA1Ib.o: in function QueryService::QueryService()': test_tinypb_server.cc:(.text._ZN12QueryServiceC2Ev[_ZN12QueryServiceC5Ev]+0x1f): undefined reference tovtable for QueryService' /usr/bin/ld: /tmp/cckIA1Ib.o: in function QueryServiceImpl::~QueryServiceImpl()': test_tinypb_server.cc:(.text._ZN16QueryServiceImplD2Ev[_ZN16QueryServiceImplD5Ev]+0x26): undefined reference toQueryService::~QueryService()' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x20): undefined reference to QueryService::GetDescriptor()' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x28): undefined reference toQueryService::CallMethod(google::protobuf::MethodDescriptor const, google::protobuf::RpcController, google::protobuf::Message const, google::protobuf::Message, google::protobuf::Closure)' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x30): undefined reference to `QueryService::GetRequestPrototype(google::protobuf::MethodDescriptor const) const' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x38): undefined reference to QueryService::GetResponsePrototype(google::protobuf::MethodDescriptor const*) const' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTI16QueryServiceImpl[_ZTI16QueryServiceImpl]+0x10): undefined reference totypeinfo for QueryService' collect2: error: ld returned 1 exit status 我再使用了g++ test_tinypb_server.cc ../lib/libtinyrpc.a -o test_tinypb_server -lprotobuf -ltinyxml -lpthread -ldl编译之后QueryService()报错,应该如何解决。
QueryService::QueryService()': test_tinypb_server.cc:(.text._ZN12QueryServiceC2Ev[_ZN12QueryServiceC5Ev]+0x1f): undefined reference to
QueryServiceImpl::~QueryServiceImpl()': test_tinypb_server.cc:(.text._ZN16QueryServiceImplD2Ev[_ZN16QueryServiceImplD5Ev]+0x26): undefined reference to
QueryService::GetDescriptor()' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x28): undefined reference to
QueryService::GetResponsePrototype(google::protobuf::MethodDescriptor const*) const' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTI16QueryServiceImpl[_ZTI16QueryServiceImpl]+0x10): undefined reference to
您好,已收到您的来信,谢谢!
luwei@haode:~/tinyrpc/testcases$ g++ test_tinypb_server.cc ../lib/libtinyrpc.a -o test_tinypb_server -lprotobuf -ltinyxml -lpthread -ldl /usr/bin/ld: /tmp/cckIA1Ib.o: in function
QueryService::QueryService()': test_tinypb_server.cc:(.text._ZN12QueryServiceC2Ev[_ZN12QueryServiceC5Ev]+0x1f): undefined reference to
vtable for QueryService' /usr/bin/ld: /tmp/cckIA1Ib.o: in functionQueryServiceImpl::~QueryServiceImpl()': test_tinypb_server.cc:(.text._ZN16QueryServiceImplD2Ev[_ZN16QueryServiceImplD5Ev]+0x26): undefined reference to
QueryService::~QueryService()' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x20): undefined reference toQueryService::GetDescriptor()' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x28): undefined reference to
QueryService::CallMethod(google::protobuf::MethodDescriptor const, google::protobuf::RpcController, google::protobuf::Message const, google::protobuf::Message, google::protobuf::Closure)' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x30): undefined reference to `QueryService::GetRequestPrototype(google::protobuf::MethodDescriptor const) const' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTV16QueryServiceImpl[_ZTV16QueryServiceImpl]+0x38): undefined reference toQueryService::GetResponsePrototype(google::protobuf::MethodDescriptor const*) const' /usr/bin/ld: /tmp/cckIA1Ib.o:(.data.rel.ro._ZTI16QueryServiceImpl[_ZTI16QueryServiceImpl]+0x10): undefined reference to
typeinfo for QueryService' collect2: error: ld returned 1 exit status 我再使用了g++ test_tinypb_server.cc ../lib/libtinyrpc.a -o test_tinypb_server -lprotobuf -ltinyxml -lpthread -ldl编译之后QueryService()报错,应该如何解决。