Search code examples
c++qtqt-creatorprotocol-buffersqmake

How to properly link third party library (like protobuf) into Qt Creator project?


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 ?


Solution

  • Just use:

    LIBS += -lprotobuf ...
    

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