[英]Protobuffers in c++ and error LNK2019: unresolved external symbol
I am new to c++ and visual studio 2012 so probably the problem is between the screen and the chair. 我是c ++和visual studio 2012的新手,所以可能问题出在屏幕和椅子之间。 I performed the following steps;
我执行了以下步骤;
Compiled the following source file; 编译了以下源文件;
#include <iostream> #include "protobuffers\\genome.pb.h" int main() { genomeMessage::Genome genome; return 0; }
Stuck... I get the following error; 坚持......我得到以下错误;
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl genomeMessage::Genome::Genome(void)" (??0Genome@genomeMessage@@QEAA@XZ) referenced in function main 1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl genomeMessage::Genome::~Genome(void)" (??1Genome@genomeMessage@@UEAA@XZ) referenced in function main 1>C:\\Projects\\testproto\\x64\\Debug\\testproto.exe : fatal error LNK1120: 2 unresolved externals
So I know it is not a missing lib file because if I move the lib file the linker complains that it can't find it. 所以我知道它不是一个缺少的lib文件,因为如果我移动lib文件,链接器会抱怨它无法找到它。 The problem is that I have no clue how to fix this ... anyone?
问题是我不知道如何解决这个问题......任何人?
According to this message: 根据这条消息:
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl genomeMessage::Genome::Genome(void)" (??0Genome@genomeMessage@@QEAA@XZ) referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl genomeMessage::Genome::~Genome(void)" (??1Genome@genomeMessage@@UEAA@XZ) referenced in function main
the source file that declares genomeMessage::Genome::Genome(void)
and genomeMessage::Genome::~Genome(void)
is not part of your project. 声明
genomeMessage::Genome::Genome(void)
和genomeMessage::Genome::~Genome(void)
genomeMessage::Genome::Genome(void)
的源文件不是您项目的一部分。
In particular, it sounds like you haven't added the genome.pb.cc
file (which is created by the Protocol Buffers compiler) to your project. 特别是,听起来您还没有将
genome.pb.cc
文件(由Protocol Buffers编译器创建)添加到您的项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.