Page 1 of 1

get error when using PROTOBUF_USE_DLL

Posted: Mon Aug 24, 2015 3:35 am
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)

Re: get error when using PROTOBUF_USE_DLL

Posted: Mon Aug 24, 2015 9:20 am
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;