#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
这个问题是我电脑有anaconda,它自带一个protobuf,和我使用vs编译的protobuf版本不一样,有两个解决方法,一个是卸载anaconda,另一个方法是vs编译的版本要和anaconda自带的版本一致。
protoc --version
使用这个命令可以查看编译proto文件的protobuf版本号
2.出现无法解析的外部符号
缺少库导致的
我们在项目属性->链接器->输入->附加依赖项中添加一个libprotobufd.lib
并且要在
项目属性->C/C++预处理器->预处理器定义中添加PROTOBUF_USE_DLLS宏定义