在 VS2013 上使用 protobuf 构建应用程序时出错
Error while building an application using protobuf on VS2013
我是 protobuf 的新手。我做了 Google 提出的教程,一切都很好。我现在正在尝试让我自己的应用程序正常工作,但我收到了一个我不明白的错误。
Error 1 error LNK2019: unresolved external symbol __imp__close referenced in function "public: bool __thiscall google::protobuf::io::FileInputStream::CopyingFileInputStream::Close(void)" (?Close@CopyingFileInputStream@FileInputStream@io@protobuf@google@@QAE_NXZ) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
Error 2 error LNK2019: unresolved external symbol __imp__read referenced in function "public: virtual int __thiscall google::protobuf::io::FileInputStream::CopyingFileInputStream::Read(void *,int)" (?Read@CopyingFileInputStream@FileInputStream@io@protobuf@google@@UAEHPAXH@Z) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
Error 3 error LNK2019: unresolved external symbol __imp__write referenced in function "public: virtual bool __thiscall google::protobuf::io::FileOutputStream::CopyingFileOutputStream::Write(void const *,int)" (?Write@CopyingFileOutputStream@FileOutputStream@io@protobuf@google@@UAE_NPBXH@Z) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
我暂时没有在我的代码中使用 protobuf。我唯一写的是
#include "helloworld.pb.h"
我的helloword.proto看起来像这样:
syntax = "proto3";
message Hello {
int32 id = 1;
string name = 2;
}
知道这里的问题吗?
unresolved symbols 对我来说听起来像是一个缺失的错误,但库实际上在这里。
我在 groups.google 上发现了一个 post,它指出了一个与我自己的问题非常相似的问题,但它对我不起作用。
Problem with linking runtime libraries on Windows for C++
上下文
- protobuf 版本 3.0
- IDE : Visual Studio 2013
我的应用程序是一个RTMAPS图(软件非常类似于simulink),以防有人听说:)
感谢大家的帮助!
编辑:答案在问题中:)
我在问题中给出的link其实就是我问题的答案。我只是没有正确更正文件。
然而奇怪的是,我是唯一一个在最新版本的 protobuf (3.0) 上遇到此错误的人。
这里又是 link 了:
Problem with linking runtime libraries on Windows for C++
希望对大家有所帮助!
我是 protobuf 的新手。我做了 Google 提出的教程,一切都很好。我现在正在尝试让我自己的应用程序正常工作,但我收到了一个我不明白的错误。
Error 1 error LNK2019: unresolved external symbol __imp__close referenced in function "public: bool __thiscall google::protobuf::io::FileInputStream::CopyingFileInputStream::Close(void)" (?Close@CopyingFileInputStream@FileInputStream@io@protobuf@google@@QAE_NXZ) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
Error 2 error LNK2019: unresolved external symbol __imp__read referenced in function "public: virtual int __thiscall google::protobuf::io::FileInputStream::CopyingFileInputStream::Read(void *,int)" (?Read@CopyingFileInputStream@FileInputStream@io@protobuf@google@@UAEHPAXH@Z) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
Error 3 error LNK2019: unresolved external symbol __imp__write referenced in function "public: virtual bool __thiscall google::protobuf::io::FileOutputStream::CopyingFileOutputStream::Write(void const *,int)" (?Write@CopyingFileOutputStream@FileOutputStream@io@protobuf@google@@UAE_NPBXH@Z) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
我暂时没有在我的代码中使用 protobuf。我唯一写的是
#include "helloworld.pb.h"
我的helloword.proto看起来像这样:
syntax = "proto3";
message Hello {
int32 id = 1;
string name = 2;
}
知道这里的问题吗?
unresolved symbols 对我来说听起来像是一个缺失的错误,但库实际上在这里。 我在 groups.google 上发现了一个 post,它指出了一个与我自己的问题非常相似的问题,但它对我不起作用。
Problem with linking runtime libraries on Windows for C++
上下文
- protobuf 版本 3.0
- IDE : Visual Studio 2013
我的应用程序是一个RTMAPS图(软件非常类似于simulink),以防有人听说:)
感谢大家的帮助!
编辑:答案在问题中:)
我在问题中给出的link其实就是我问题的答案。我只是没有正确更正文件。 然而奇怪的是,我是唯一一个在最新版本的 protobuf (3.0) 上遇到此错误的人。
这里又是 link 了: Problem with linking runtime libraries on Windows for C++
希望对大家有所帮助!