protoc v3.5.0 displayed as v2.5.0 with --version option

176 views
Skip to first unread message

Gabriel Mahoux

unread,
May 29, 2020, 10:10:23 AM5/29/20
to Protocol Buffers
Hello.
I downloaded the code source from v3.5.0 and generated the bin "protoc.exe"
for Win 64b.
When I execute "protoc --version", it returned "v2.5.0".

In my "google/protobuf/stubs/common.h" file, the GOOGLE_PROTOBUF_VERSION
and GOOGLE_PROTOBUF_MIN_PROTOC_VERSION constants are set to 3005000.

// The current version, represented as a single integer to make comparison

// easier: major * 10^6 + minor * 10^3 + micro

#define GOOGLE_PROTOBUF_VERSION 3005000


// A suffix string for alpha, beta or rc releases. Empty for stable releases.

#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""


// The minimum library version which works with the current version of the

// headers.

#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3005000


// The minimum header version which works with the current version of

// the library. This constant should only be used by protoc's C++ code

// generator.

static const int kMinHeaderVersionForLibrary = 3005000;


// The minimum protoc version which works with the current version of the

// headers.

#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3005000

But, when I generated my class (in C++):
- the proto file shall have the syntax proto2 (proto3 is unrecognized)
- the header make a check between those and the value 2005000 !!!

So, compilation displays the associated error message :

#include <google/protobuf/stubs/common.h>

#if GOOGLE_PROTOBUF_VERSION < 2005000

#error This file was generated by a newer version of protoc which is

#error incompatible with your Protocol Buffer headers. Please update

#error your headers.

#endif


#if 2005000 < 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


How can I get the correct version number for the version checking with the
correct syntax version (version 3.5.0 expected)?

Thank you.

Gabriel Mahoux

unread,
Jun 1, 2020, 1:30:11 PM6/1/20
to Protocol Buffers
I tried again and it worked.
I don't know what I did differently, but whatever.
Reply all
Reply to author
Forward
0 new messages