2

I have succesfully managed to build Protobuf on WIndows XP using MSYS 1.0 (C:\msys\) and MinGW from Qt 5.2 bundle (C:\Qt\Qt5.2.1\) following these steps.

The result is that I have following 8 files in C:\msys\local\lib

  • libprotobuf-8.dll (7,9MB)
  • libprotobuf-lite-8.dll (0,9MB)
  • libprotobuf-lite.a(1,1MB)
  • libprotobuf-lite.dll.a (0,3MB)
  • libprotobuf-lite.la (1KB)
  • libprotobuf.a (10,3MB)
  • libprotobuf.dll.a (2MB)
  • libprotobuf.la (1KB)

Which is the correct file I need to include in my Qt project, where to place it and how to properly link it (there are three choices in "Include library wizard" in Qt Creator). What would be the best practice ?

Community
  • 1
  • 1
Kousalik
  • 3,111
  • 3
  • 24
  • 46

1 Answers1

1

Just use:

LIBS += -lprotobuf ...

etc. I would place the dlls next your binary if they are only used by your project.

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • That is what I tried as first, unfortunately it didn't work. But I have already figured it out. You have to copy headers from msys/local/include and libs from msys/local/lib into Qt\...\mingw\local and lib. Then it works. – Kousalik Apr 04 '14 at 10:29
  • @Kousalik: works for me. Moreover, you are supposed to provide everything you have ever tried not to waste others' time. – László Papp Apr 04 '14 at 10:33
  • I'm sorry. What am I doing wrong ? When I follow the above mentioned protobuf build steps then I get Error: google/protobuf/stubs/common.h: No such file or directory #include . Everything is fine when I manualy copy related files from msys /lib;/include into MinGWs /lib;/include. Then it works fine but that step isn't mentioned anywhere. I thought that the --prefix=`cd /mingw; pwd -W` should do this work but it does not. – Kousalik Apr 04 '14 at 10:59
  • And that helps how ? This error came from my project where the linking according to your answer is done. Forgive me, I'm just trying to get the bigger picture. I'm not much experienced in C++ development, especially on Windows. – Kousalik Apr 04 '14 at 11:29