Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. LNK1104: cannot find .lib-file
Forum Updated to NodeBB v4.3 + New Features

LNK1104: cannot find .lib-file

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 4 Posters 1.7k Views 2 Watching
  • 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.
  • E Offline
    E Offline
    Efstein
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #2

      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.

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

        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.

        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
        • E Offline
          E Offline
          Efstein
          wrote on last edited by
          #4

          Hi,
          thanks for your reply! I think I found the mistake, I had to add the Project dependencies in Jc_Messprogramm.pro, so for example

          Control.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?

          jsulmJ 1 Reply Last reply
          0
          • E Efstein

            Hi,
            thanks for your reply! I think I found the mistake, I had to add the Project dependencies in Jc_Messprogramm.pro, so for example

            Control.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?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @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

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • E Offline
              E Offline
              Efstein
              wrote on last edited by
              #6

              Ah yes, that's it, it is working now. Thank you all very much for your help! :)

              1 Reply Last reply
              0

              • Login

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