Reputation: 6624
This question is related to this one I posted earlier : How to include a library in a Qt project.
I'm trying to create Qt a project that uses the TagLib library. I'm not really sure of how exactly to go about it.
I have downloaded TagLib 1.11.1.
I built it following steps in this tutorial:
Build zlib, by first having CMake create a Visual Studio solution file, then building this solution with Visual Studio:
mkdir build && cd build cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="e:\workspace\lib\installed" msbuild /P:Configuration=Debug INSTALL.vcxproj msbuild /P:Configuration=Release INSTALL.vcxproj
Build TagLib much in the same way:
cd ....\taglib-1.11.1 mkdir build && cd build cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="e:\workspace\lib\installed" -DZLIB_INCLUDE_DIR="e:\workspace\lib\installed\include" -DZLIB_LIBRARY="e:\workspace\lib\installed\lib\zlib.lib" -DWITH_ASF=on -DWITH_MP4=on -DBUILD_EXAMPLES=on msbuild /P:Configuration=Release INSTALL.vcxproj
This building procedure doesn't seem to work in a Qt project.
Could somebody please point me in the right direction as to how to build taglib Release 1.11.1 (Windows 10).
Something in the direction like what is HERE** could really be helpful. I'm starting up on C++ and documentation on building liblaries is really limited. It could save a lot of time, for anyone else trying to build liblaries for use on Qt.
Thank you all in advance.
Upvotes: 0
Views: 2124
Reputation: 566
If you have sources of TagLib, you can create a solution in MS VS 2015, then add a subproject that contains your Qt project and another subproject (namely DLL library) that contains TagLib. After that you can link your Qt project against TagLib:
Properties
.Common Properties
, References
.Add new reference
and add TagLib project.C/C++
, General
, Additional Include Directories
.After that you can include just filenames in your Qt project without relative paths. For example:
#include "SomeHeaderFromTagLib.h"
If you have questions, feel free to ask, I'll update the post.
UPDATE 1 You can use Qt Creator instead of Visual Studio. Community version can be downloaded from Qt website. Documentation how to configure CMake using Qt Creator:
http://doc.qt.io/qtcreator/creator-project-cmake.html
UPDATE 2 Make sure that you're using corresponding Qt version. If you're dealing with MS VS 2015 C++ compiler, then you should use Qt version that is built using this and only this compiler (msvc2015 version).
UPDATE 3 If you're using Qt MSVC 2013 32 bit, then you should use 32 bit TagLib library. You should compile it with following option:
cmake .. -G"Visual Studio 12 2013"
instead of
cmake .. -G"Visual Studio 14 2015 Win64"
Note that you should have MS VC 2013 compiler on your machine.
After you compile TagLib, open your Qt project in Qt Creator:
Add library...
External
Then right-click on the whole project and choose Run qmake
.
After that you should be able to build the project.
Upvotes: 1