在GOOGLE_PROTOBUF_MIN_PROTOC_VERSION检查期间进行编译时出现协议缓冲区错误 [英] Protocol Buffer Error on compile during GOOGLE_PROTOBUF_MIN_PROTOC_VERSION check
问题描述
我当前遇到错误,将我指向protoc生成的头文件中的这些行:
I'm currently getting an error which points me to these lines in the header file produced by 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
但是我的协议版本与上面的版本匹配:
But my protoc version matches the one above:
protoc --version
libprotoc 2.6.1
我在做什么错了?
最初,我的协议版本是3.0.0,然后通过同步回2.6.1并执行以下步骤来重新安装它; make distclean,./configure,make,make install以安装所需的2.6.1版本.我需要较旧的版本,因为那是我们服务器中安装的版本.
Originally my protoc version was 3.0.0 then reinstalled it by syncing back to 2.6.1 and doing the steps; make distclean, ./configure , make, make install to install the desired 2.6.1 version. I needed the older version since that's the one installed in our servers.
推荐答案
问题是系统上(在/usr/include/google/protobuf或/usr/local/include/google/protobuf中)安装的标头是来自比您的protoc
更高版本的协议缓冲区.可能是两个版本都安装在不同的位置,并且使用了错误的版本.
The problem is that the installed headers on your system (in /usr/include/google/protobuf or /usr/local/include/google/protobuf) are from a newer version of Protocol Buffers than your protoc
. It may be the case that you have both versions installed in different locations, and the wrong one is being used.
但是我的协议版本与上面的版本匹配:
But my protoc version matches the one above:
是的,因为该代码是由您的protoc
生成的,并且它知道自己的版本.该代码会询问:我的版本(2006001)是否低于安装的标头要求的最低版本(GOOGLE_PROTOBUF_MIN_PROTOC_VERSION)?"
Yes, because that code was generated by your protoc
, and it knows its own version. The code is asking: "Is my version (2006001) less than the minimum version which the installed headers claim is required (GOOGLE_PROTOBUF_MIN_PROTOC_VERSION)?"
这篇关于在GOOGLE_PROTOBUF_MIN_PROTOC_VERSION检查期间进行编译时出现协议缓冲区错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!