Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Nested project structur Qt 5.15.2 MSVC2019 linker problem

Nested project structur Qt 5.15.2 MSVC2019 linker problem

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 421 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kluszon
    wrote on last edited by
    #1

    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_tests

    application-with-test.pro

    TEMPLATE = 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?

    1 Reply Last reply
    0
    • K kluszon

      @SGaist Should I do some special export for MSVC?

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @kluszon yes, it's explained in the Creating Shared Libraries.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        K 1 Reply Last reply
        1
        • SGaistS SGaist

          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.

          K Offline
          K Offline
          kluszon
          wrote on last edited by
          #3

          @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.

          SGaistS 1 Reply Last reply
          0
          • K kluszon

            @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.

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @kluszon are you properly exporting your classes ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            K 1 Reply Last reply
            0
            • SGaistS SGaist

              @kluszon are you properly exporting your classes ?

              K Offline
              K Offline
              kluszon
              wrote on last edited by
              #5

              @SGaist Should I do some special export for MSVC?

              SGaistS 1 Reply Last reply
              0
              • K kluszon

                @SGaist Should I do some special export for MSVC?

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @kluszon yes, it's explained in the Creating Shared Libraries.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • K kluszon has marked this topic as solved on

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved