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. MSVC fatal error LNK1181: cannot open input file
Forum Updated to NodeBB v4.3 + New Features

MSVC fatal error LNK1181: cannot open input file

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 3 Posters 3.6k Views 1 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.
  • B Offline
    B Offline
    Bremenpl
    wrote on last edited by
    #1

    Hello there,
    I am using Qt Creator with Qt 5.13.0 and MSVC 2017 x64. The debug build for my application works just fine. I have switched to release build just not and was unable to compile because of:

    LINK : fatal error LNK1181: cannot open input file 'release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.obj'
    

    My .pro file looks like this:

    # The application version
    VERSION = 1.0
    
    OTHER_FILES += app.rc
    RC_FILE = app.rc
    
    QT += quick widgets core xml multimedia opcua
    CONFIG += c++11
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS APP_VERSION=\\\"$$VERSION\\\"
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    
    # disables all the APIs deprecated before Qt 6.0.0
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
    
    HEADERS += \
        ccolumns.h \
        cdataentry.h \
    	cdatastatus.h \
        cdimmode.h \
        cexecutable.h \
        cfleetmanager.h \
        cintegrator.h \
        cnodeextractor.h \
        cnodetype.h \
        criskdata.h \
        crisklevel.h \
        criskname.h \
        criskstate.h \
        cscreenview.h \
        csettings.h \
        cthreadmover.h \
        cuaproxy.h \
    	copcuahelper.h \
        cvartablemodel.h \
        cvessel.h \
        domitem.h \
        dommodel.h
    
    SOURCES += \
        cdataentry.cpp \
        cexecutable.cpp \
        cfleetmanager.cpp \
        cintegrator.cpp \
        cnodeextractor.cpp \
        csettings.cpp \
        cthreadmover.cpp \
        cvartablemodel.cpp \
        cvessel.cpp \
        domitem.cpp \
        dommodel.cpp \
            main.cpp \
        criskdata.cpp \
        cuaproxy.cpp \
    	copcuahelper.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    DISTFILES +=
    

    I was wondering what could be the case in here. I would appreciate all help.

    lprzenioslo.zut.edu.pl

    jsulmJ 1 Reply Last reply
    0
    • B Bremenpl

      Hello there,
      I am using Qt Creator with Qt 5.13.0 and MSVC 2017 x64. The debug build for my application works just fine. I have switched to release build just not and was unable to compile because of:

      LINK : fatal error LNK1181: cannot open input file 'release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.obj'
      

      My .pro file looks like this:

      # The application version
      VERSION = 1.0
      
      OTHER_FILES += app.rc
      RC_FILE = app.rc
      
      QT += quick widgets core xml multimedia opcua
      CONFIG += c++11
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which as been marked deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS APP_VERSION=\\\"$$VERSION\\\"
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      
      # disables all the APIs deprecated before Qt 6.0.0
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
      
      HEADERS += \
          ccolumns.h \
          cdataentry.h \
      	cdatastatus.h \
          cdimmode.h \
          cexecutable.h \
          cfleetmanager.h \
          cintegrator.h \
          cnodeextractor.h \
          cnodetype.h \
          criskdata.h \
          crisklevel.h \
          criskname.h \
          criskstate.h \
          cscreenview.h \
          csettings.h \
          cthreadmover.h \
          cuaproxy.h \
      	copcuahelper.h \
          cvartablemodel.h \
          cvessel.h \
          domitem.h \
          dommodel.h
      
      SOURCES += \
          cdataentry.cpp \
          cexecutable.cpp \
          cfleetmanager.cpp \
          cintegrator.cpp \
          cnodeextractor.cpp \
          csettings.cpp \
          cthreadmover.cpp \
          cvartablemodel.cpp \
          cvessel.cpp \
          domitem.cpp \
          dommodel.cpp \
              main.cpp \
          criskdata.cpp \
          cuaproxy.cpp \
      	copcuahelper.cpp
      
      RESOURCES += qml.qrc
      
      # Additional import path used to resolve QML modules in Qt Creator's code model
      QML_IMPORT_PATH =
      
      # Additional import path used to resolve QML modules just for Qt Quick Designer
      QML_DESIGNER_IMPORT_PATH =
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      DISTFILES +=
      

      I was wondering what could be the case in here. I would appreciate all help.

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

      @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

      release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.obj

      Is this really the path you get in the error message?

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

      B 2 Replies Last reply
      0
      • jsulmJ jsulm

        @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

        release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.obj

        Is this really the path you get in the error message?

        B Offline
        B Offline
        Bremenpl
        wrote on last edited by
        #3

        @jsulm yes, I have no idea how was it constructed.

        lprzenioslo.zut.edu.pl

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

          release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.obj

          Is this really the path you get in the error message?

          B Offline
          B Offline
          Bremenpl
          wrote on last edited by Bremenpl
          #4

          @jsulm Looking at the Makefile, it does create this bizzare path'es only for release build:

          SOURCES       = ..\ntm_client\cdataentry.cpp \
          		..\ntm_client\cexecutable.cpp \
          		..\ntm_client\cfleetmanager.cpp \
          		..\ntm_client\cintegrator.cpp \
          		..\ntm_client\cnodeextractor.cpp \
          		..\ntm_client\csettings.cpp \
          		..\ntm_client\cthreadmover.cpp \
          		..\ntm_client\cvartablemodel.cpp \
          		..\ntm_client\cvessel.cpp \
          		..\ntm_client\domitem.cpp \
          		..\ntm_client\dommodel.cpp \
          		..\ntm_client\main.cpp \
          		..\ntm_client\criskdata.cpp \
          		..\ntm_client\cuaproxy.cpp \
          		..\ntm_client\copcuahelper.cpp release\qrc_qml_qmlcache.cpp \
          		release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.cpp \
          		release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Utopbar_qml.cpp \
          		release\C:_storage_repo_bergen_MDE-Clients_ntm_client_UcontrolButton_qml.cpp \
          

          lprzenioslo.zut.edu.pl

          jsulmJ 1 Reply Last reply
          0
          • B Bremenpl

            @jsulm Looking at the Makefile, it does create this bizzare path'es only for release build:

            SOURCES       = ..\ntm_client\cdataentry.cpp \
            		..\ntm_client\cexecutable.cpp \
            		..\ntm_client\cfleetmanager.cpp \
            		..\ntm_client\cintegrator.cpp \
            		..\ntm_client\cnodeextractor.cpp \
            		..\ntm_client\csettings.cpp \
            		..\ntm_client\cthreadmover.cpp \
            		..\ntm_client\cvartablemodel.cpp \
            		..\ntm_client\cvessel.cpp \
            		..\ntm_client\domitem.cpp \
            		..\ntm_client\dommodel.cpp \
            		..\ntm_client\main.cpp \
            		..\ntm_client\criskdata.cpp \
            		..\ntm_client\cuaproxy.cpp \
            		..\ntm_client\copcuahelper.cpp release\qrc_qml_qmlcache.cpp \
            		release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Uslider_qml.cpp \
            		release\C:_storage_repo_bergen_MDE-Clients_ntm_client_Utopbar_qml.cpp \
            		release\C:_storage_repo_bergen_MDE-Clients_ntm_client_UcontrolButton_qml.cpp \
            
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Bremenpl Really strange. Try to delete the *.pro.user file, delete build directory, run qmake and build.

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

            B 2 Replies Last reply
            0
            • jsulmJ jsulm

              @Bremenpl Really strange. Try to delete the *.pro.user file, delete build directory, run qmake and build.

              B Offline
              B Offline
              Bremenpl
              wrote on last edited by Bremenpl
              #6

              @jsulm Its the same. Qmake creates makesfiles in a different way for the Debug and Release builds.

              This is the qmake call for the debug build:

              C:\Qt\5.13.0\msvc2017_64\bin\qmake.exe C:\storage\repo\bergen\MDE-Clients\ntm_client\ntm_client.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" && C:/Qt/Tools/QtCreator/bin/jom.exe qmake_all
              

              And this one is for release:

              C:\Qt\5.13.0\msvc2017_64\bin\qmake.exe C:\storage\repo\bergen\MDE-Clients\ntm_client\ntm_client.pro -spec win32-msvc "CONFIG+=qtquickcompiler" && C:/Qt/Tools/QtCreator/bin/jom.exe qmake_all
              

              lprzenioslo.zut.edu.pl

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @Bremenpl Really strange. Try to delete the *.pro.user file, delete build directory, run qmake and build.

                B Offline
                B Offline
                Bremenpl
                wrote on last edited by
                #7

                @jsulm Ok, disabling the Qt Quick Compiler solved the problem. What does it do anyways? Its disabled in the Debug build. Does it attempts to compile the QML code so the QML files are not needed?

                lprzenioslo.zut.edu.pl

                jsulmJ J.HilkJ 2 Replies Last reply
                0
                • B Bremenpl

                  @jsulm Ok, disabling the Qt Quick Compiler solved the problem. What does it do anyways? Its disabled in the Debug build. Does it attempts to compile the QML code so the QML files are not needed?

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

                  @Bremenpl See https://doc.qt.io/QtQuickCompiler/
                  Not sure why it breaks the build. Maybe you have to do something in your pro file to use it properly (I never used it, so don't know).

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

                  B 1 Reply Last reply
                  0
                  • B Bremenpl

                    @jsulm Ok, disabling the Qt Quick Compiler solved the problem. What does it do anyways? Its disabled in the Debug build. Does it attempts to compile the QML code so the QML files are not needed?

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

                    @jsulm Ok, disabling the Qt Quick Compiler solved the problem. What does it do anyways? Its disabled in the Debug build. Does it attempts to compile the QML code so the QML files are not needed?

                    It indeed takes your qml files, precompiles them to usable binary. In end effect makes the startup process of your application much faster, as the interpreter does not have to parse your QML files before each start.

                    I'm using it all the time, and have had never this problem.

                    Can you check if the problem persists, if you define a specific directory for the generated files inside your *pro file ?
                    using:

                    OBJECTS_DIR 
                    MOC_DIR 
                    RCC_DIR 
                    UI_DIR 
                    QMLCACHE_DIR
                    

                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    B 1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @Bremenpl See https://doc.qt.io/QtQuickCompiler/
                      Not sure why it breaks the build. Maybe you have to do something in your pro file to use it properly (I never used it, so don't know).

                      B Offline
                      B Offline
                      Bremenpl
                      wrote on last edited by
                      #10

                      @jsulm Ok, I thought I was missing qtquickcompiler in the pro file CONFIG section but that did not change anything... On linux side using GCC everything works without unckecing the qt quick compiler, maybe its a windows only thing.

                      lprzenioslo.zut.edu.pl

                      1 Reply Last reply
                      0
                      • J.HilkJ J.Hilk

                        @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

                        @jsulm Ok, disabling the Qt Quick Compiler solved the problem. What does it do anyways? Its disabled in the Debug build. Does it attempts to compile the QML code so the QML files are not needed?

                        It indeed takes your qml files, precompiles them to usable binary. In end effect makes the startup process of your application much faster, as the interpreter does not have to parse your QML files before each start.

                        I'm using it all the time, and have had never this problem.

                        Can you check if the problem persists, if you define a specific directory for the generated files inside your *pro file ?
                        using:

                        OBJECTS_DIR 
                        MOC_DIR 
                        RCC_DIR 
                        UI_DIR 
                        QMLCACHE_DIR
                        
                        B Offline
                        B Offline
                        Bremenpl
                        wrote on last edited by
                        #11

                        @J.Hilk Which DIR(s) should I set exactly?

                        lprzenioslo.zut.edu.pl

                        J.HilkJ 1 Reply Last reply
                        0
                        • B Bremenpl

                          @J.Hilk Which DIR(s) should I set exactly?

                          J.HilkJ Offline
                          J.HilkJ Offline
                          J.Hilk
                          Moderators
                          wrote on last edited by J.Hilk
                          #12

                          @Bremenpl since it's the *.obj files that make the problems, OBJECTS_DIR ?

                          but the quick compiler generated files fall in the QMLCACHE_DIR category


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          B 1 Reply Last reply
                          0
                          • J.HilkJ J.Hilk

                            @Bremenpl since it's the *.obj files that make the problems, OBJECTS_DIR ?

                            but the quick compiler generated files fall in the QMLCACHE_DIR category

                            B Offline
                            B Offline
                            Bremenpl
                            wrote on last edited by
                            #13

                            @J.Hilk said in MSVC fatal error LNK1181: cannot open input file:

                            @Bremenpl sinds it's the *.obj files that make the problems, OBJECTS_DIR ?

                            Of course, had to make sure...
                            Ok, so I added this entry to the pro file:

                            OBJECTS_DIR = K:\obj
                            

                            And for some reason it works now, nice call!
                            The generated Makefile.Release is no longer corrupted.

                            lprzenioslo.zut.edu.pl

                            jsulmJ 1 Reply Last reply
                            1
                            • B Bremenpl

                              @J.Hilk said in MSVC fatal error LNK1181: cannot open input file:

                              @Bremenpl sinds it's the *.obj files that make the problems, OBJECTS_DIR ?

                              Of course, had to make sure...
                              Ok, so I added this entry to the pro file:

                              OBJECTS_DIR = K:\obj
                              

                              And for some reason it works now, nice call!
                              The generated Makefile.Release is no longer corrupted.

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

                              @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

                              OBJECTS_DIR = K:\obj

                              Just a note: you should use / instead of \ in pro files even on Windows.

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

                              B 2 Replies Last reply
                              1
                              • jsulmJ jsulm

                                @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

                                OBJECTS_DIR = K:\obj

                                Just a note: you should use / instead of \ in pro files even on Windows.

                                B Offline
                                B Offline
                                Bremenpl
                                wrote on last edited by
                                #15

                                @jsulm It would be best for me to use something like:

                                OBJECTS_DIR = config_name/obj
                                

                                But for over half hour I cannot figure out what is the variable name in pro file storing the current build config name...

                                lprzenioslo.zut.edu.pl

                                1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @Bremenpl said in MSVC fatal error LNK1181: cannot open input file:

                                  OBJECTS_DIR = K:\obj

                                  Just a note: you should use / instead of \ in pro files even on Windows.

                                  B Offline
                                  B Offline
                                  Bremenpl
                                  wrote on last edited by
                                  #16

                                  @jsulm Btw, I have removed the OBJECTS_DIR entry and now the compilation is correct. All obj files are placed in the default location...

                                  lprzenioslo.zut.edu.pl

                                  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