[Dependencies] Never had so much difficulties to integrate a library (protobuf) in my life (C++ / Qt / Windows)

759 views
Skip to first unread message

Gkn Knc

unread,
Oct 18, 2015, 5:27:37 PM10/18/15
to Protocol Buffers
Hi,

I have decided to use protobuf because it looked like cool and well documented, I've learned almost everything from it (past almost 4 days on Google's tutorials), but now I begin to regret my choice.

First of all those are my tools :
* My implementation language : C++
* Operating System : Windows 7 (sorry guys)
* IDE : Qt Creator (Community) with MinGW included in it.
* protobuf : currently stable release 2.6.1

My steps :
  1. I have followed Google's tutorial here : https://developers.google.com/protocol-buffers/docs/cpptutorial#compiling-your-protocol-buffers
  2. I have downloaded protoc for Windows and source code here (currently stable release 2.6.1) : https://developers.google.com/protocol-buffers/docs/downloads
  3. I have generated my .proto thanks to protoc and obtained my "file.pb.h" and "file.pb.cc".
  4. I have integrated those two files into my Qt project.
  5. I have tried to compile my project... and here problems comming !

My problem :
I have huge dependency problems because everytime I want to compile there's a missing dependency !

First this following dependency is missing from my "file.pb.h"
    => #include <google/protobuf/stubs/common.h>

Let's think about it... Google's tutorial don't even mention this dependency problem... but I know this file because I have already seen it somewhere in the source code !
So I decide to unzip source code from .tar.gz and integrate the "/google/protobuf/" folder in my Qt project...
I realize that common.h was only a begenning ! Because now it ask me other dependencies like "gtest.h" or "config.h" !


My gut tells me that I would never had this integration problem if I used Maven with Java but let's forget this personal detail... please help me, I am stucked with all those dependency problems. What is the standard way to solve this integration problem under Windows ?


Thanks.

sumit kumar

unread,
Oct 19, 2015, 11:31:32 AM10/19/15
to Gkn Knc, Protocol Buffers
Java guy trying C++, right ?

Its not protobuf's fault, its your lack of C++ knowledge. You just need to set these 3 things in your project:
  • Include path of the protobuf include folder (this folder contains the google directory)
  • The protobuf lib path
  • The libprobuf as lib dependency on your project

Maven won't do this magically either, you still need to set the pom. Anyway, if you were able to use protoc, you have all of these on your system. The host directory of protoc is where you should start to look.

Regards,
Sumit Kumar



Date: Sun, 18 Oct 2015 14:27:37 -0700
From: gokan.ek...@gmail.com
To: prot...@googlegroups.com
Subject: [protobuf] [Dependencies] Never had so much difficulties to integrate a library (protobuf) in my life (C++ / Qt / Windows)
--
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+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Gkn Knc

unread,
Oct 19, 2015, 3:12:24 PM10/19/15
to Protocol Buffers, gokan.ek...@gmail.com
I know C++ since 8 years, so it's not related with my C++ knowledge but the lack of Google's documentation for the integration part.


"Include path of the protobuf include folder (this folder contains the google directory)"
=> I have already downloaded the source code and done this part.

"The protobuf lib path"
=> What is it ? Where can I find it ? How can I use it ?


"The libprobuf as lib dependency on your project"
=> What is it ? Where can I find it ?


"if you were able to use protoc, you have all of these on your system. The host directory of protoc is where you should start to look"
Well I am working under Windows, so I have downloaded Google's zip file (stable release 2.6.1) which contains two thins : the "protoc.exe" and a text file, nothing more.

Thanks for your help Sumit Kumar ;)
Reply all
Reply to author
Forward
0 new messages