LNK1104: cannot find .lib-file
-
Hi everybody!
I'm quite new to Qt and I'm running out of ideas to solve this problem. I'm working on Windows 10 with Qt Creator 6.2.2, Qt version 5.15.2.
I have a subdirs-project with seven libraries calles Control, GUI, Keithley2651A, KeithleyDMM6500, Measurements, PPMS and Stuff. The general .pro file looks like this:
Jc_Messprogramm.pro:TEMPLATE = subdirs SUBDIRS += \ Control \ GUI \ Keithley2651A \ KeithleyDMM6500 \ Measurements \ PPMS \ Stuff \
and the .pro-files in my librariese all look like this (here Stuff.pro, as an example):
QT -= gui TEMPLATE = lib DEFINES += STUFF_LIBRARY CONFIG += c++17 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ filereader.cpp \ filewriter.cpp \ gpib.cpp \ status.cpp HEADERS += \ Stuff_global.h \ filereader.h \ filewriter.h \ gpib.h \ ni488.h \ status.h # Default rules for deployment. unix { target.path = /usr/lib } !isEmpty(target.path): INSTALLS += target win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Measurements/release/ -lMeasurements \ -L$$OUT_PWD/../Control/release/ -lControl \ -L$$OUT_PWD/../Keithley2651A/release/ -lKeithley2651A \ -L$$OUT_PWD/../KeithleyDMM6500/release/ -lKeithleyDMM6500 \ -L$$OUT_PWD/../PPMS/release/ -lPPMS else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../Measurements/debug/ -lMeasurements \ -L$$OUT_PWD/../Control/debug/ -lControl \ -L$$OUT_PWD/../Keithley2651A/debug/ -lKeithley2651A \ -L$$OUT_PWD/../KeithleyDMM6500/debug/ -lKeithleyDMM6500 \ -L$$OUT_PWD/../PPMS/debug/ -lPPMS else:unix: LIBS += -L$$OUT_PWD/../Measurements/ -lMeasurements \ -L$$OUT_PWD/../Control/ -lControl \ -L$$OUT_PWD/../Keithley2651A/ -lKeithley2651A \ -L$$OUT_PWD/../KeithleyDMM6500/ -lKeithleyDMM6500 \ -L$$OUT_PWD/../PPMS/ -lPPMS INCLUDEPATH += $$PWD/../Measurements \ $$PWD/../Control \ $$PWD/../Keithley2651A \ $$PWD/../KeithleyDMM6500 \ $$PWD/../PPMS DEPENDPATH += $$PWD/../Measurements \ $$PWD/../Control \ $$PWD/../Keithley2651A \ $$PWD/../KeithleyDMM6500 \ $$PWD/../PPMS
but now I get the errors
LNK1104: cannot open file "PPMS.lib" LNK1104: cannot open file "Keithley2651A.lib" LNK1104: cannot open file "Measurements.lib" LNK1104: cannot open file "Stuff.lib"
And if I look into the build-folder, I can't find the .lib-files.
Is there something I am missing? I have already tried different MSVC and MinGW kits. -
Can you tell from the build/compile output if those other sub-projects were built before you are getting these link errors? In the 'Compile Output' window does it show you the full link command that produces these errors? If so, paste it here.
I have come to really like using CMake instead of qmake, one reason being that it's smarter about handling sub-project dependencies. For linking to another sub-project, you just need to specify the subproject's name in a target_link_libraries() statement without having to worry about the path.
-
Hi and welcome to devnet,
Did you properly setup the dependencies between the projects ? If not, you will have them compiled in an arbitrary order.
-
Hi,
thanks for your reply! I think I found the mistake, I had to add the Project dependencies in Jc_Messprogramm.pro, so for exampleControl.depends = Measurements PPMS Keithley2651A KeithleyDMM6500 Stuff
Now the error does not appear anymore, but there is another compiler error:
Error: cycle in targets detected: sub-Stuff-qmake_all 11:12:06: The process "E:\Programme\Qt\Tools\QtCreator\bin\jom\jom.exe" exited with code 2. Error while building/deploying project Jc_Messprogramm (kit: Desktop Qt 5.15.2 MSVC2019 64bit) When executing step "qmake"
Any idea where this is coming from?
-
@Efstein said in LNK1104: cannot find .lib-file:
Any idea where this is coming from?
Sounds like you have a circular dependency in your projects. Check the pro files, especially the one from sub-Stuff