Protobuf 3.2.0 + Qt 5.8 (Windows)

1,619 views
Skip to first unread message

Mastic Cover

unread,
Mar 3, 2017, 6:16:14 AM3/3/17
to Protocol Buffers
Hi everyone,

I'm trying to build Protobuf with Minwg from MSYS2 as specified in documentation (C++ Installation - Windows). Everything goes perfect and all libraries are created.

The problem comes trying to compile and test the "addressbook" sample in Qt/C++. After generating the .pb.cc and .pb.h, I add this to my .pro file inside my Qt project:


# Google Protocol Buffers library
INCLUDEPATH += "C:\\protobuf\\install\\include"
LIBS += -L"C:\\protobuf\\install\\lib" -llibprotobuf



A lot of "undefined reference" errors (almost 200 errors) are shown and I am not able to make it work:

C:\Qt Developments\MyProject\protoFolder\addressbook.pb.cc:86: error: undefined reference to `google::protobuf::internal::AssignDescriptors(std::string const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'

C:\Qt Developments\MyProject\protoFolder\addressbook.pb.cc:97: error: undefined reference to `google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)'

C:\Qt Developments\MyProject\protoFolder\addressbook.pb.cc:112: error: undefined reference to `google::protobuf::internal::VerifyVersion(int, int, char const*)'

And so on...


Has anyone ever come across this error? Same proccess, same project, tested in a Fedora machine... it works like a charm! But I have to make it work on Windows :(

Thanks in advance for your help.

Mastic.

Mastic Cover

unread,
Mar 3, 2017, 6:19:12 AM3/3/17
to Protocol Buffers
EDIT:

Tested this:


# Google Protocol Buffers library
INCLUDEPATH += "C:\\protobuf\\install\\include"
LIBS += -L"C:\\protobuf\\install\\lib" -llibprotobuf


And this one:

# Google Protocol Buffers library
INCLUDEPATH += "C:\\protobuf\\install\\include"
LIBS += -L"C:\\protobuf\\install\\lib" -lprotobuf


Same result over and over again.

Adam Cozzette

unread,
Mar 7, 2017, 5:11:22 PM3/7/17
to Mastic Cover, Protocol Buffers
My first guess would be that you are somehow mixing different protobuf versions: using generated code from a new version of protoc with a protobuf runtime library of an older version. Is that true for your Windows setup?

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Mario Emmenlauer

unread,
Mar 14, 2017, 2:59:19 PM3/14/17
to Mastic Cover, Protocol Buffers

Hey,

I've run into the same problem. According to what I found on the internet,
Qt ships protobuf < 3.2, and there was no straightforward way to disable it.
Eventually they will conflict, so I needed to downgrade protobuf to 3.1
again to make it work.

I hope the next Qt release will upgrade protobuf and/or allow to configure it.

Cheers,

Mario



On 03.03.2017 12:19, Mastic Cover wrote:
> EDIT:
>
> Tested this:
>
> *# Google Protocol Buffers library
> INCLUDEPATH += "C:\\protobuf\\install\\include"
> LIBS += -L"C:\\protobuf\\install\\lib" -llibprotobuf*
>
> And this one:
>
> *# Google Protocol Buffers library
> INCLUDEPATH += "C:\\protobuf\\install\\include"
> LIBS += -L"C:\\protobuf\\install\\lib" -lprotobuf*
>
>
> Same result over and over again.
>
>
>
>
> El viernes, 3 de marzo de 2017, 12:16:14 (UTC+1), Mastic Cover escribió:
>
> Hi everyone,
>
> I'm trying to build Protobuf with Minwg from MSYS2 as specified in documentation (C++ Installation - Windows). Everything goes perfect and all libraries are
> created.
>
> The problem comes trying to compile and test the "addressbook" sample in Qt/C++. After generating the .pb.cc and .pb.h, I add this to my .pro file inside my
> Qt project:
>
>
> *# Google Protocol Buffers library
> INCLUDEPATH += "C:\\protobuf\\install\\include"
> LIBS += -L"C:\\protobuf\\install\\lib" -llibprotobuf*
>
>
> A lot of "undefined reference" errors (almost 200 errors) are shown and I am not able to make it work:
>
> /C:\Qt Developments\MyProject\protoFolder\addressbook.pb.cc:86 <http://addressbook.pb.cc:86>: error: undefined reference to
> `google::protobuf::internal::AssignDescriptors(std::string const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const*
> const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**,
> google::protobuf::ServiceDescriptor const**)'
>
> C:\Qt Developments\MyProject\protoFolder\addressbook.pb.cc:97 <http://addressbook.pb.cc:97>: error: undefined reference to
> `google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)'
>
> C:\Qt Developments\MyProject\protoFolder\addressbook.pb.cc:112 <http://addressbook.pb.cc:112>: error: undefined reference to
> `google::protobuf::internal::VerifyVersion(int, int, char const*)'
>
> And so on.../
>
> Has anyone ever come across this error? Same proccess, same project, tested in a Fedora machine... it works like a charm! But I have to make it work on
> Windows :(
>
> Thanks in advance for your help.



Viele Gruesse,

Mario Emmenlauer


--
BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203
Balanstr. 43 mailto: memmenlauer * biodataanalysis.de
D-81669 München http://www.biodataanalysis.de/

Mastic Cover

unread,
Apr 12, 2017, 5:29:17 AM4/12/17
to Protocol Buffers, masti...@gmail.com
No mixing protobuf versions, clean protobuf build and project from https://developers.google.com/protocol-buffers/docs/cpptutorial

Linux --> Ok
Windows --> Fail
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.

Mastic Cover

unread,
Apr 12, 2017, 5:35:33 AM4/12/17
to Protocol Buffers, masti...@gmail.com
Si Mario,

I switched to another project and left this in standby, but I tried protobuf 3.1.0 and 3.0.2 and same problem.

I hope to get back into it in a few weeks and do more testing, but it was hopeless :/

Thanks,

Mastic
Reply all
Reply to author
Forward
Message has been deleted
0 new messages