Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
LNK1104 after adding custom libaries
TKowalski last edited by TKowalski
I'm pretty new to the whole Qt thing, but everything seems to be okay for me, besides this one. In my project, I need to use two third party libraries: RapidJSON and TinyXML2.
I downloaded their code on GitHub, and compiled them using MingW (using g++ -o tinyxml2.o tinyxml2.h and then ar rcs libtinyxml2.a tinyxml2.o). After, I just added the library to my project, using Qt Creator, and tried to compile.
But I can't. I get a LNK1104 error from the compiler: "can't open file 'tinyxml2d.lib'". After restarting, I also have this now :
:-1: erreur : dependent 'D:\Users\thoma\Documents\TEST\C:\Libs\tinyxml2d.lib' does not exist.
I mean, it's kind of normal it can find it since I only have .a and not .lib files. What am I missing ?
I'm using Windows 10 (x64).
EDIT : I tried to remove the various $$PWD/ from the .pro file, and I'm getting the first error message again.
Welcome to the Qt forum!
I need to use two third party libraries: RapidJSON and TinyXML2.
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/C:/Libs/libtinyxml2.a else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/C:/Libs/libtinyxml2d.a else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/C:/Libs/tinyxml2.lib else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/C:/Libs/tinyxml2d.lib
This assumes you're linking static libraries. Furthermore mingw (win32-g++) doesn't generate
libfiles, but archives -
.a, because it's a port of Linux's g++ ... and based on this pro file I'd say you're compiling your project with MSVC (the error code/formatting is also a giveaway). You can't mix compilers! Either compile everything with MSVC or with mingw.
TKowalski last edited by
I guess I'll just use the Qt's implementations then. Thanks for the explanation though.