繁体   English   中英

C ++ Protobuf错误google :: protobuf :: internal :: kEmptyString错误

[英]C++ Protobuf Error google::protobuf::internal::kEmptyString Error

我在连接protobuf库时遇到了一个问题。

/tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x444):未定义对google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4a9): undefined reference to谷歌:: protobuf的::内部:: kEmptyString” /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4c4):未定义参照google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4de): undefined reference to TickData.pb.cc:( google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4de): undefined reference to google :: protobuf :: internal :: kEmptyString'/ tmp / ccKgczB9.o:TickData.pb.cc :(的google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4de): undefined reference to .text + 0x502):对google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x53c): more undefined references to +0x53c)的未定义引用:对google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x53c): more undefined references to internal :: kEmptyString',请遵循/tmp/ccKgczB9.o:TickData.pb.cc:(.text$_ZN6google8protobuf8internal10WireFormat16VerifyUTF8StringEPKciNS2_9OperationE[__ZN6google8protobuf8internal10WireFormat16VerifyUTF_String:perprob: const *,int,google :: p rotobuf :: internal :: WireFormat :: Operation)'collect2:error:ld返回1退出状态

使用语言:C ++ Protobuf版本:2.6.1

我已经在下面的链接上尝试了一些东西,但它没有成功:

无法从Google协议缓冲区编译示例

未定义的引用google :: protobuf :: internal :: empty_string_ [abi:cxx11]

我是C ++的新手。 我也尝试过使用-std = c ++ 11编译protobuf,但仍然是相同的错误。

任何指针都会有所帮助。

我确实找到了出路。

我需要先为g ++使用-c选项并生成.o文件。 然后再单独使用-o选项生成可执行文件。

如下所示:

g ++ -c -L / cygdrive / d / Workspace / CPP / Practice / .libs /../proto/TickData.pb.cc main.cpp -std = c ++ 11 -lprotobuf

g ++ -g -Wall TickData.pb.o main.o -o MarketData.o -std = c ++ 11 -lprotobuf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM