get error when using PROTOBUF_USE_DLL

RCFProto support and general discussion.
Post Reply
markqiu
Posts: 18
Joined: Wed Sep 12, 2012 11:13 am

get error when using PROTOBUF_USE_DLL

Post by markqiu »

1> 正在创建库 C:\workspace\RCFProto-src-1.1.0.0\cpp\demo\vs2008\bin\Debug\DemoServer.lib 和对象 C:\workspace\RCFProto-src-1.1.0.0\cpp\demo\vs2008\bin\Debug\DemoServer.exp
1>Demo.pb.obj : error LNK2001: 无法解析的外部符号 "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const google::protobuf::internal::kEmptyString" (?kEmptyString@internal@protobuf@google@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)
1>JczI.pb.obj : error LNK2001: 无法解析的外部符号 "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const google::protobuf::internal::kEmptyString" (?kEmptyString@internal@protobuf@google@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)
1>RequestService.obj : error LNK2001: 无法解析的外部符号 "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const google::protobuf::internal::kEmptyString" (?kEmptyString@internal@protobuf@google@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)

markqiu
Posts: 18
Joined: Wed Sep 12, 2012 11:13 am

Re: get error when using PROTOBUF_USE_DLL

Post by markqiu »

Please noted it's for protobuf 2.4.1. The other version has not tested.
the answer is at: https://groups.google.com/forum/#!msg/p ... cCxXVh_Q8J

hi, i've sloved this issue by modyfing files
enerated_message_util.h/cc adding decoration LIBPROTOBUF_EXPORT:

double LIBPROTOBUF_EXPORT Infinity();
double LIBPROTOBUF_EXPORT NaN();
extern LIBPROTOBUF_EXPORT const ::std::string kEmptyString;

Post Reply