Windows - Linker fails because main.obj not found. Where are my compiled .obj files?
-
It seems like my files compile fine, but when I finally get to linking stage it can't find them. They aren't there when I look in the configured build directory, although moc_(...).cpp files are in there.
This is an example of the
cl
command that qt is using:cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -P -O2 -MD -std:c++17 -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -I..\rdk_qt -I. -I..\..\rdk_qt_common\rdk_qt_common -I..\..\..\..\Downloads\vcpkg\installed\x64-windows\include -I..\..\rdk\include -I..\..\rdk_core\include -I..\..\generic_multi_map -I..\generated -I..\..\rdk\win_build_dep\boost -I..\..\rdk\win_build_dep\yaml-cpp\include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCharts -IC:\Qt\5.12.6\msvc2017_64\include\QtWidgets -IC:\Qt\5.12.6\msvc2017_64\include\QtGui -IC:\Qt\5.12.6\msvc2017_64\include\QtANGLE -IC:\Qt\5.12.6\msvc2017_64\include\QtNetwork -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Irelease -I/include -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\sebas\AppData\Local\Temp\nm519B.tmp main.cpp show_dialog.cpp transform_manager.cpp
I am wondering if the
-Forelease\ @C:\Users\sebas\AppData\Local\Temp\nm519B.tmp
option could be the issue. Why is there\ @
in the path? I understand that this option sets the output location for the.obj
files, but shouldn't that be the configured build directory? What is this.tmp
folder?Later on I get the linker error which prevents my build:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\RDK.exe @C:\Users\sebas\AppData\Local\Temp\nm9C2D.tmp LINK : fatal error LNK1181: cannot open input file 'release\main.obj'
I'm porting this project from linux and I'm a bit new to windows, so any help is appreciated. I'm trying to manually run the
cl
commands and see if I generates an.obj
file for me. But even if that works I still need to get this working in the normal way.OS: Windows 10
QT-Creator: 4.10.2
QT: 5.13.2
MSVC: 2017, 32 bit -
It seems like my files compile fine, but when I finally get to linking stage it can't find them. They aren't there when I look in the configured build directory, although moc_(...).cpp files are in there.
This is an example of the
cl
command that qt is using:cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -P -O2 -MD -std:c++17 -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -I..\rdk_qt -I. -I..\..\rdk_qt_common\rdk_qt_common -I..\..\..\..\Downloads\vcpkg\installed\x64-windows\include -I..\..\rdk\include -I..\..\rdk_core\include -I..\..\generic_multi_map -I..\generated -I..\..\rdk\win_build_dep\boost -I..\..\rdk\win_build_dep\yaml-cpp\include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCharts -IC:\Qt\5.12.6\msvc2017_64\include\QtWidgets -IC:\Qt\5.12.6\msvc2017_64\include\QtGui -IC:\Qt\5.12.6\msvc2017_64\include\QtANGLE -IC:\Qt\5.12.6\msvc2017_64\include\QtNetwork -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Irelease -I/include -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\sebas\AppData\Local\Temp\nm519B.tmp main.cpp show_dialog.cpp transform_manager.cpp
I am wondering if the
-Forelease\ @C:\Users\sebas\AppData\Local\Temp\nm519B.tmp
option could be the issue. Why is there\ @
in the path? I understand that this option sets the output location for the.obj
files, but shouldn't that be the configured build directory? What is this.tmp
folder?Later on I get the linker error which prevents my build:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\RDK.exe @C:\Users\sebas\AppData\Local\Temp\nm9C2D.tmp LINK : fatal error LNK1181: cannot open input file 'release\main.obj'
I'm porting this project from linux and I'm a bit new to windows, so any help is appreciated. I'm trying to manually run the
cl
commands and see if I generates an.obj
file for me. But even if that works I still need to get this working in the normal way.OS: Windows 10
QT-Creator: 4.10.2
QT: 5.13.2
MSVC: 2017, 32 bit@Sebastian_-- said in Windows - Linker fails because main.obj not found. Where are my compiled .obj files?:
-Forelease\ @C:\Users\sebas\AppData\Local\Temp\nm519B.tmp
Hello and welcome.
The
@C:\Users\sebas\AppData\Local\Temp\nm519B.tmp
is a MSVClink
response file. The@
means that it reads the content of that file for linker input/options. It is often used because of restrictions on Windows/LINK command-line length. Doubtless the build process puts the LINK input files into that temporary file when it is about to callLINK
. You probably won't be able to find the file after the linking has finished as it will deleted.I think the
-Forelease\
is its own option, not joined to the@C:\...
which comes after it. So your "output" directory is namedrelease
. It's a relative path, so presumably relative to wherever the command is running.LINK : fatal error LNK1181: cannot open input file 'release\main.obj'
Go find where this file is actually located. If necessary search your whole disk(s) for
main.obj
and see what it comes up with. -
Hello and thanks for the response. I am glad to learn from your explanation.
My issue was caused by my stupid mistake. I was using the
-P
compiler flag as suggested online to help debug something else. I didn't realize that this would suppress the compilation and generation of.obj
files. So I left it on and this was causing my issue.Thanks again for your help.
-
Hello and thanks for the response. I am glad to learn from your explanation.
My issue was caused by my stupid mistake. I was using the
-P
compiler flag as suggested online to help debug something else. I didn't realize that this would suppress the compilation and generation of.obj
files. So I left it on and this was causing my issue.Thanks again for your help.
@Sebastian_-- said in Windows - Linker fails because main.obj not found. Where are my compiled .obj files?:
I didn't realize that this would suppress the compilation and generation of .obj files.
:)