Unsolved MSVC fatal error LNK1181: cannot open input file
-
@jsulm yes, I have no idea how was it constructed.
-
@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 \
-
@Bremenpl Really strange. Try to delete the *.pro.user file, delete build directory, run qmake and build.
-
@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
-
@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?
-
@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). -
@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
-
@jsulm Ok, I thought I was missing
qtquickcompiler
in the pro fileCONFIG
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. -
@J.Hilk Which DIR(s) should I set exactly?
-
@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
-
@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 generatedMakefile.Release
is no longer corrupted. -
@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.
-
@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...
-
@jsulm Btw, I have removed the
OBJECTS_DIR
entry and now the compilation is correct. All obj files are placed in the default location...