Nested project structur Qt 5.15.2 MSVC2019 linker problem
-
I tried to compile my Linux application with subprojects on Windows with MinGW and Qt 5.15.2, but I need for it QWebEngine and it required MSVC2019. I'm trying to do it, but I can't solve the linker error: "LINK : fatal error LNK1104: cannot open file "application_src.lib""
Project structure:
-> application-with-test
--> application_app
--> application_src
--> application_testsTEMPLATE = subdirs CONFIG += ordered SUBDIRS += \ application_src \ application_app \ application_tests application_app.depends = application_src application_tests.depends = application_src OTHER_FILES += \ defaults.pri
application_app.pro
include(../defaults.pri) TEMPLATE = app QT += qml quick TARGET = application-with-test CONFIG += c++1z CONFIG -= app_bundle CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT SOURCES += source/main.cpp unix { LIBS += -L../application_src -lapplication_src } win32 { CONFIG(debug, debug|release) { LIBS += -L$$OUT_PWD/../application_src/debug/ -lapplication_src } CONFIG(release, debug|release) { LIBS += -L$$OUT_PWD/../application_src/release/ -lapplication_src } }
application_src.pro
include(../defaults.pri) QT += qml quick TARGET = application_src CONFIG += c++1z TEMPLATE = lib HEADERS += \ xyz.h SOURCES += \ xyz.cpp RESOURCES += \ qml.qrc \ resources.qrc
application_tests.pro
TEMPLATE = subdirs SUBDIRS += \ xyz_tests
I tired to add staticlib to CONFIG in application_src.pro, but it finished with other error "LNK2001 unresolved external symbol ......" Any suggestion on how to solve it without resigning from the project structure?
-
@kluszon yes, it's explained in the Creating Shared Libraries.
-
Hi,
The unix block for linking to the library is missing the
$$OUT_PWD
in the-L
statement. Take a look at the win32 block. -
Hi,
The unix block for linking to the library is missing the
$$OUT_PWD
in the-L
statement. Take a look at the win32 block. -
@SGaist It doesn't change anything, I still have "LINK : fatal error LNK1104: cannot open file "application_src.lib" and no .lib file in the build directory.
-
@kluszon yes, it's explained in the Creating Shared Libraries.
-