Reputation: 21135
I am currently trying to make the move from C# and break free from my platform boundaries by using Qt / C++.
I was using TagLibSharp in my old project, but I'm now trying to use the original C++ source found here:
http://developer.kde.org/~wheeler/taglib.html
I am in a world of hurt trying to compile this into my application. Most of this Linux based C++ is gibberish to me and I don't know how to properly include this library into my project with Qt. I'm using Qt Creator for the bulk of my work (everything I possibly can).
Can anyone please point me to some helpful tutorial or guides? Anything to help me understand what I am even doing with this source would be greatly appreciated. I have a very thorough understanding of C# and Windows programming, but I don't exactly have a good handle on what I'm doing with these types of open source projects.
Thanks!
EDIT - THE ANSWER IS HERE I decided to post another question that was a bit more refined for it.
Compiling static TagLib 1.6.3 libraries for Windows
Some older edits...
I now have TagLib compiled with Qt, but am running into "Undefined reference" errors.
*.pro
INCLUDEPATH += ../$${TARGET}/taglib-win32
LIBS += -L"..\\$${TARGET}\\taglib-win32"
LIBS += -llibtag #It seems to want this to be a *.dll, not a *.a?
DEFINES += TAGLIB_NO_CONFIG
*.cpp
#include <tag.h>
#include <fileref.h>
...
//None of these work, even though they are similar to examples given in TagLib source.
TagLib::FileRef f("03.flac");
TagLib::String test = f.tag()->album();
TagLib::FileName *n = new TagLib::FileName("test");
TagLib::FileRef *f = new TagLib::FileRef();
Here are some examples of the exact errors:
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:20: undefined reference to `_imp___ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE'
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:21: undefined reference to `_imp___ZNK6TagLib7FileRef3tagEv'
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:42: undefined reference to `_imp___ZN6TagLib6StringD1Ev'
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:42: undefined reference to `_imp___ZN6TagLib7FileRefD1Ev'
collect2: ld returned 1 exit status
Command line steps using g++ (Mac/Linux)
Upvotes: 2
Views: 5768
Reputation: 3233
If you're new to C++ programming there are several issues you have to grasp to accomplish your task:
*.cpp
) contain the actual source code, while header files (*.h
) just declare what's inside a source file. You have to include all headers in your source files that use classes/functions/variables from other source files.TEMPLATE=lib
, CONFIG+=dll
)MAKE_TAGLIB_LIB
(in your taglib .pro file: DEFINES+=MAKE_TAGLIB_LIB
)TEMPLATE=lib
, then adding all sources and headers of taglib). When you use gcc this will result in two files TagLib.dll
and libTagLib.a
.LIBS+=libTagLib.a
)TagLib::Tag
in your source file, then you must #include <taglib/tag.h>
; You also have to tell the compiler (to be precise: the preprocessor) where it can find the taglib
directory. In your .pro file you do this by adding INCLUDEPATH+=/path/to/taglib
. These are the big points and are not an in-depth explanation of what you have to do. Please ask more detailed questions if you have a problem when realizing this points.
For more information look at the qmake manual: http://doc.trolltech.com/4.6/qmake-variable-reference.html#libs
Upvotes: 2