Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Problem adding an external library to QtCreator
I have those 2 lines in my .pro file :
@INCLUDEPATH += C:/Users/username/Downloads/Compressed/id3lib-3.8.3/id3lib-3.8.3/include
LIBS += LC:/Users/username/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug -lid3lib
The includes are found all right with auto-completion. When linking, I get this:
LNK1104: cannot open file 'C:/Users/userame/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug.obj'
I have no idea what QtCreator is after here.
tilsitt last edited by
your LIBS line miss a '-' in front of 'L':
LIBS += -LC:/Users/username/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug -lid3lib
I applied the dash as suggested and now I get unresolved externals for all the library methods I use.
LNK2019: unresolved external symbol "public: class ID3_Field * __cdecl ID3_Frame::GetField(enum ID3_FieldID)const " (?GetField@ID3_Frame@@QEBAPEAVID3_Field@@W4ID3_FieldID@@@Z) referenced in function "private: char const * __cdecl Song::_fieldNameFromFrame(class std::shared_ptr<class ID3_Frame>)const " (?_fieldNameFromFrame@Song@@AEBAPEBDV?$shared_ptr@VID3_Frame@@@std@@@Z)
tilsitt last edited by
Ok, now it's not about Qt anymore. The compiler says it: your lib doesn't contain the symbols. I guess C:/Users/username/Downloads/Compressed/id3lib-3.8.3binaries/id3lib-3.8.3binaries/Debug contains a file called id3lib.lib? Did you compile it yourself? Is it a static or shared library?
Thanks. It contains that file, and I didn't compile it myself, I downloaded it. I'm trying to link it statically using this preprocessor directive:
I don't know, but the same method calls from id3lib in visual studio work just fine. The problem is, I can't find the visual studio addin installer anymore, to develop in VS instead.
So I installed the "Visual Studio addin":http://ftp.fau.de/qtproject/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe, which highlighted that I was using 64-bit Qt for a 32-bit build:
module machine type 'x64' conflicts with target machine type 'X86' ...\Qt5Cored.lib(Qt5Cored.dll).
So I downloaded the 32-bit Qt and rebuilt and it seems to compile fine.