fatal error LNK1104: cannot open file 'C:\Qt\5.15.2\msvc2019_64\lib.obj
-
wrote on 30 May 2024, 13:48 last edited by james b-s
Just installed qt 6.7.1. There appears to be an old installation on my system
Windows 11. Visual studio 2022
Installed the visual studio qt add-in (qt visual studio tools version 3.2.0 (rev 47))
qt/versions is set to 6.7.1\msvc2019_64. For some reason 5.15.2\msvc2019 shows up in the list but isn't selected.The visual studio additional include directories is set to %(AdditionalIncludeDirectories);$(ProjectDir);$(Qt_INCLUDEPATH_);E:\qtnodes\include;E:\qtnodes\examples\lock_nodes_and_connections;$(QTDIR)/include;$(QTDIR)/include/QtWidgets
I think I had to add some stuff to that to get things to compile. Everything compiles now.
When I try to build, I get fatal error LNK1104: cannot open file 'C:\Qt\5.15.2\msvc2019_64\lib.obj. For some reason, qt has visual studio looking at 5.15.2 instead of 6.7.1
The linker additional dependencies is currently set to %(AdditionalDependencies);$(Qt_LIBS_);$(QTDIR)\lib
I added the last one, but it didn't make any difference.The system environment variables does not show any environment variables for qt, but I suspect that is OK.
Not sure what to try next. I expected the visual studio addin to just configure things so that they would work. It always has in the past.
I just noticed that that isn't the first thing going wrong. Evidently, it is trying to read the 5.15.2 confiuration
Build started...
1>------ Build started: Project: QtQuickApplication1, Configuration: Debug x64 ------
1>Reading Qt configuration (C:/Qt/5.15.2/msvc2019_64/bin/qmake)
1>DelegateNodeModel.cpp
1>main.cpp
1>qrc_qml.cpp
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1096,5): error MSB6006: "link.exe" exited with code 1104.
1>LINK : fatal error LNK1104: cannot open file 'C:\Qt\5.15.2\msvc2019_64\lib.obj'
1>Done building project "QtQuickApplication1.vcxproj" -- FAILED.Also, my qt installation is on my e drive. It is looking on the c drive
Update: The <PropertyGroup>/<QtInstall> setting in the VS project file was set wrong. I've changed it to 6.7.1_msvc2019_64. The build is now looking in the right area, but it still can't find lib.obj.
1>LINK : fatal error LNK1104: cannot open file 'E:\Qt\6.7.1\msvc2019_64\lib.obj'
-
Just installed qt 6.7.1. There appears to be an old installation on my system
Windows 11. Visual studio 2022
Installed the visual studio qt add-in (qt visual studio tools version 3.2.0 (rev 47))
qt/versions is set to 6.7.1\msvc2019_64. For some reason 5.15.2\msvc2019 shows up in the list but isn't selected.The visual studio additional include directories is set to %(AdditionalIncludeDirectories);$(ProjectDir);$(Qt_INCLUDEPATH_);E:\qtnodes\include;E:\qtnodes\examples\lock_nodes_and_connections;$(QTDIR)/include;$(QTDIR)/include/QtWidgets
I think I had to add some stuff to that to get things to compile. Everything compiles now.
When I try to build, I get fatal error LNK1104: cannot open file 'C:\Qt\5.15.2\msvc2019_64\lib.obj. For some reason, qt has visual studio looking at 5.15.2 instead of 6.7.1
The linker additional dependencies is currently set to %(AdditionalDependencies);$(Qt_LIBS_);$(QTDIR)\lib
I added the last one, but it didn't make any difference.The system environment variables does not show any environment variables for qt, but I suspect that is OK.
Not sure what to try next. I expected the visual studio addin to just configure things so that they would work. It always has in the past.
I just noticed that that isn't the first thing going wrong. Evidently, it is trying to read the 5.15.2 confiuration
Build started...
1>------ Build started: Project: QtQuickApplication1, Configuration: Debug x64 ------
1>Reading Qt configuration (C:/Qt/5.15.2/msvc2019_64/bin/qmake)
1>DelegateNodeModel.cpp
1>main.cpp
1>qrc_qml.cpp
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1096,5): error MSB6006: "link.exe" exited with code 1104.
1>LINK : fatal error LNK1104: cannot open file 'C:\Qt\5.15.2\msvc2019_64\lib.obj'
1>Done building project "QtQuickApplication1.vcxproj" -- FAILED.Also, my qt installation is on my e drive. It is looking on the c drive
Update: The <PropertyGroup>/<QtInstall> setting in the VS project file was set wrong. I've changed it to 6.7.1_msvc2019_64. The build is now looking in the right area, but it still can't find lib.obj.
1>LINK : fatal error LNK1104: cannot open file 'E:\Qt\6.7.1\msvc2019_64\lib.obj'
@james-b-s said in fatal error LNK1104: cannot open file 'C:\Qt\5.15.2\msvc2019_64\lib.obj:
cannot open file 'E:\Qt\6.7.1\msvc2019_64\lib.obj'
I'm wondering what lib.obj supposed to be?
-
wrote on 31 May 2024, 06:29 last edited by
Hi, the culprit might be that $(QTDIR)\lib you added as a linker additional dependency, so even though that directory does not contain any *.lib files (only the subdirectories do) the linker adds that as a dummy .lib file anyway (note: just a guess :-)
-
wrote 16 days ago last edited by visa 6 Jan 2025, 10:58
I hit the same problem when compiling hpp_proto after configuring and generating CS2022 solution.
I got
fatal error LNK1104: cannot open file '..\vcpkg\installed\x64-windows\debug\lib.obj'the generator had added "..\vcpkg\installed\x64-windows\debug\lib" instead of "..\vcpkg\installed\x64-windows\debug\zlibd.lib" under %AdditionalDependencies%
Fixing that solved my issue.