GOOGLE_PROTOBUF_MIN_PROTOC_VERSION期间编译时的协议缓冲区错误检查

时间:2016-03-02 10:28:12

标签: c++ protocol-buffers protoc

我目前收到错误,指出我在protoc生成的头文件中的这些行:

#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#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.
#endif

但我的protoc版本符合上述版本:

protoc --version
libprotoc 2.6.1

我做错了什么?

最初我的protoc版本是3.0.0然后通过同步回到2.6.1并执行步骤重新安装它; make distclean,./ configure,make,make install来安装所需的2.6.1版本。我需要旧版本,因为那是我们服务器中安装的版本。

1 个答案:

答案 0 :(得分:11)

问题是系统上安装的标头(在/ usr / include / google / protobuf或/ usr / local / include / google / protobuf中)来自较新版本的Protocol Buffers而不是protoc 。可能是您在不同位置安装了两个版本,并且使用了错误的版本。

  

但我的protoc版本符合上述版本:

是的,因为该代码是由protoc生成的,并且它知道自己的版本。代码询问:&#34;我的版本(2006001)是否低于所需安装的标题所声明的最低版本(GOOGLE_PROTOBUF_MIN_PROTOC_VERSION)?&#34;

相关问题