MS C++ 2012 linker hangs but only in debug mode x64 - c++

I just upgraded to MSVC 2012 Express (which is saying trial btw. I wonder why as it should be free). After lots of changes from MSVC 2005 it started working, but the linker hangs, but only in debug mode x64, in all other 3 modes it works! Here are the commandline arguments (I called it from a script, but it does the same thing when called from IDE).
cl.exe /fp:precise /Od /MTd /bigobj /RTCscu /Zi /GS- /TP /Fd"!temp/DebugDebug1/MRotary/vc70.pdb" /D_USRDLL /D_WINDLL /D_WINDOWS
/DWIN64 /Fo"!temp/DebugDebug1/MRotary/main.obj"
/FR"!temp/DebugDebug1/MRotary/" /I "C:/Program Files (x86)/Microsoft
Visual Studio 11.0/Vc/include" /I "C:/Program Files (x86)/Windows
Kits/8.0/Include/um" /I "C:/Program Files (x86)/Windows
Kits/8.0/Include/shared" /I "C:/Program Files
(x86)/Intel/IPP/6.1.2.041/em64t/include" /D_MBCS /c /W3 /EHsc /GF /Gd
/Zc:wchar_t /Zc:forScope /nologo MDrummer/VSTEffects/main.cpp
link.exe !temp/DebugDebug1/MRotary/icon.res !temp/DebugDebug1/MRotary/main.obj
!temp/DebugDebug1/MRotary/resourcesrotary.obj
!temp/DebugDebug1/MRotary/mlibrary.obj mlibraryasm_x64_debug.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib comctl32.lib wsock32.lib winmm.lib msimg32.lib psapi.lib
opengl32.lib Glu32.lib freetype_x64_debug.lib zlib_x64_debug.lib
libpng_x64_debug.lib libtiff_x64_debug.lib libjpeg_x64_debug.lib
giflib_x64_debug.lib bzip2_x64_debug.lib libflac_x64_debug.lib
vstsdk3_x64_debug.lib ippcoreem64tl.lib ippsemergedem64t.lib
ippsmergedem64t.lib ippiemergedem64t.lib ippimergedem64t.lib
ippvmemergedem64t.lib ippvmmergedem64t.lib /OUT:"c:/program
files/vstplugins/MeldaProductionx64/Modulation/MRotary.dll"
/INCREMENTAL:NO /DEBUG /MACHINE:X64 /SUBSYSTEM:WINDOWS
/DEF:"D:/Programming/Mlibrary/mvstplugin.def" /DLL
/IMPLIB:"D:/Programming/MDrummer/!temp/DebugDebug1/MRotary.lib"
/PDB:"c:/program
files/vstplugins/MeldaProductionx64/Modulation/MRotary.pdb"
/LIBPATH:"D:/Programming/Mlibrary/library"
/LIBPATH:"D:/Programming/MDrummer"
/LIBPATH:"D:/Programming/MDrummer/!temp/DebugDebug1"
/LIBPATH:"D:/Programming/MDrummer/c:\program
files\vstplugins\MeldaProductionx64" /LIBPATH:"C:/Program Files
(x86)/Microsoft Visual Studio 11.0/Vc/lib/amd64" /LIBPATH:"C:/Program
Files (x86)/Windows Kits/8.0/Lib/win8/um/x64" /LIBPATH:"C:/Program
Files (x86)/Intel/IPP/6.1.2.041/em64t/lib" /LIBPATH:"C:/Program Files
(x86)/Intel/IPP/6.1.2.041/em64t/stublib" /OPT:REF /OPT:ICF /nologo
/MANIFEST:NO
Any ideas? I searched there have been troubles with this, but nothing seems related to this specific one.

Ok so apparently it starts working if I remove "/OPT:REF /OPT:ICF", but why and why only in such specific circumstances, that's a question...

Related

vscode cmake mvsc compiler not found [duplicate]

This question already has answers here:
CMake cannot open "ucrtd.lib"
(3 answers)
Closed 11 months ago.
I downloaded vscode with (C/C++ and cmake extentions) and Visual Studio Tools 2022. Created and QuickStart project with the cmake extention which is a simple:
#include <iostream>
int main(int, char**) {
std::cout << "Hello, world!\n";
}
cmake_minimum_required(VERSION 3.0.0)
project(hello-cmake VERSION 0.1.0)
include(CTest)
enable_testing()
add_executable(hello-cmake main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
but I keep getting this error:
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\Will\AppData\Local\CMakeTools\cmake-tools-kits.json
[visual-studio] Patch Windows SDK bin path from C:\Program Files (x86)\Windows Kits\10\bin\x86 to C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86 for C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -Sc:/Users/Will/source/hello-cmake -Bc:/Users/Will/source/hello-cmake/build -G "Visual Studio 17 2022"
[main] Configuring folder: hello-cmake
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Sc:/Users/Will/source/hello-cmake -Bc:/Users/Will/source/hello-cmake/build -G "Visual Studio 17 2022"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
[cmake] -- The C compiler identification is unknown
[cmake] -- The CXX compiler identification is unknown
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake] No CMAKE_C_COMPILER could be found.
[cmake]
[cmake]
[cmake]
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake] No CMAKE_CXX_COMPILER could be found.
[cmake]
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/Will/source/hello-cmake/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "C:/Users/Will/source/hello-cmake/build/CMakeFiles/CMakeError.log".
[visual-studio] Patch Windows SDK bin path from C:\Program Files (x86)\Windows Kits\10\bin\x86 to C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86 for C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat
this is the CMakeError
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/1/2022 5:43:21 PM.
Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc143.pdb" /external:W0 /Gd /TC /FC /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X64 Debug\CMakeCCompilerId.obj
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.60
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/1/2022 5:43:21 PM.
Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc143.pdb" /external:W0 /Gd /TC /FC /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X64 Debug\CMakeCCompilerId.obj
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdC\CompilerIdC.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.43
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/1/2022 5:43:22 PM.
Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdCXX.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdCXX.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc143.pdb" /external:W0 /Gd /TP /FC /errorReport:queue CMakeCXXCompilerId.cpp
CMakeCXXCompilerId.cpp
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X64 Debug\CMakeCXXCompilerId.obj
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj]
Done Building Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.44
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/1/2022 5:43:23 PM.
Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdCXX.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdCXX.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc143.pdb" /external:W0 /Gd /TP /FC /errorReport:queue CMakeCXXCompilerId.cpp
CMakeCXXCompilerId.cpp
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X64 Debug\CMakeCXXCompilerId.obj
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj]
Done Building Project "C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\Users\Will\source\hello-cmake\build\CMakeFiles\3.22.22022201-MSVC_2\CompilerIdCXX\CompilerIdCXX.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.44
This is actually the answer.
https://stackoverflow.com/a/71418520/6656422
10.0.19041.0is a bad windows sdk version. I installed 10.0.20348.0 and it works no problem.

Can try-catch blocks be compiled on LLVM / MSVC?

I'm trying to change the compiler collection of a project which uses a lot of exceptions (try/catch blocks) from Microsoft Visual C++ to LLVM, but ran into compilation issues.
Used tool chain:
Visual Studio 2015 Enterprise (MSVC 14)
LLVM 3.7 Windows/x64
Here is some test source code:
#include <iostream>
int main()
{
try
{
throw 20;
}
catch (int e)
{
std::cout << "An exception occurred. Exception Nr. " << e << '\n';
}
return 0;
}
Compiling the code with the built-in Visual Studio compiler collection (v140), this are the command line results:
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe
/c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise
/Zc:wchar_t /Zc:forScope /Zc:inline /Fo "Debug\\" /Fd"Debug\vc140.pdb" /Gd /TP
/analyze- /errorReport:queue Main.cpp
Main.cpp
Link:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe
/ERRORREPORT:QUEUE /OUT:"C:\Users\jurocha\Desktop\ClangExcept\Debug\ClangExcept.exe"
/INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
/MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /Debug
/PDB:"C:\Users\jurocha\Desktop\ClangExcept\Debug\ClangExcept.pdb" /TLBID:1
/DYNAMICBASE /NXCOMPAT
/IMPLIB:"C:\Users\jurocha\Desktop\ClangExcept\Debug\ClangExcept.lib"
/MACHINE:X86 Debug\Main.obj
Compilation succeeds.
Now, changing the compilers to LLVM (LLVM-vs2014):
ClCompile:
C:\Program Files\LLVM\3.7\msbuild-bin\CL.exe
/c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise
/Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc140.pdb" /Gd /TP
/analyze- /errorReport:queue -m32 -fmsc-version=1900 Main.cpp
clang-cl.exe : warning : argument unused during compilation: '/ZI' [ClangExcept.vcxproj]
clang-cl.exe : warning : argument unused during compilation: '/Gm' [ClangExcept.vcxproj]
clang-cl.exe : warning : argument unused during compilation: '/GS' [ClangExcept.vcxproj]
Main.cpp(7,3): error : cannot use 'throw' with exceptions disabled [ClangExcept.vcxproj]
throw 20;
^
Main.cpp(5,2): error : cannot use 'try' with exceptions disabled [ClangExcept.vcxproj]
try
^
2 errors generated.
According to this document, http://clang.llvm.org/docs/MSVCCompatibility.html:
"Exceptions and SEH: Partial". But I can't make enough sense of it.
Has anyone been able to achieve this?
The LLVM page you link to says
Exceptions and SEH: Partial. C++ exceptions (try / catch / throw) and structured exceptions (__try / __except / __finally) mostly work on x64. 32-bit exception handling support is being worked on.
But in your link parameters for VC++ you have /MACHINE:X86, and you also pass -m32 to LLVM, which indicates that you try to build a 32-bit application - the model that doesn't work.
Change your settings to build a 64-bit executable instead.
Your example with exceptions now compile and even run in 32 bits with visual 2015 Community Update 1 using LLVM-3.9.0svn-r258602-win64.exe which can be found here
http://sourceforge.net/projects/clangonwin/

How to grab what command line parameters are being sent to cl.exe in Visual Studio?

So I'm trying to figure out what command line arguments are being sent to cl.exe in Visual Studio 2013 when you build a project.
I need this for a side-project that just uses the actual cl.exe and send in parameters via a text file.
For example:
/Zc:wchar_t /fp:precise /D "WIN32" /D "_CONSOLE" /D "_LIB" /D "_UNICODE" /D "UNICODE" /EHsc /Od /MT *.cpp kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /link /FORCE:MULTIPLE /OUT:Output.exe
is in the text file to use for cl.exe.
However compiling the program using cl.exe only works barely half of the time. The program will either lock up or crash.
Compiling the program in Visual Studio with F7 (Build) works 100% of the time, so the only thing I can think of why it doesn't work and crash on cl.exe is because I have the wrong parameters.
There are two ways to get the command line from the project property page:
In the C/C++ section there is a "Command Line" subsection that lists the command line that will be used (without the file name parameter).
In the C/C++ section in the General Subsection, change "Suppress Startup Banner" to "No". This will then print the command line used for each source file in the output window when you build.

linker issue moving a C++ project from vs2005 to vs2010

I am attempting to convert a project from Visual Studio 2005 to 2010. (To write a plugin for Maya 2014 as it is x64 only).
To start I am compiling with VS2010 against Maya 2013 x86. This compilation and linking works fine with VS 2005 but with 2010 I get a raft of errors along the lines:
error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,char const *,int)" (??3#YAXPAXPBDH#Z) referenced in function __unwindfunclet$?creator#exporter##SAPAXXZ$0
I have attached the command line that generates the output below (some parts omitted for clarities sake). You will note the VS toolset differs from 80 to 100 (2005 vs 2010) and the block { project libs compiled with VS2005 .sln file } is missing from 2010 linker. This block is the list of dependant projects compiled by Visual Studio as part of the solution build.
Do you know how I can get these locally built libs to show up in the 2010 linker? Should I even expect them too? And can anyone suggest other points of attack to resolve this?
2005 c/c++
/Od /I "C:\Program Files (x86)\Autodesk\Maya2013\include" /I {our engine include} /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "NT_PLUGIN" /D "REQUIRE_IOSTREAM" /D "_WINDLL" /FD /EHsc /MTd /Fp{pch file output} /Fo"Debug_2013\" /Fd"Debug_2013\vc80.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
2010 c/c++
/I"C:\Program Files (x86)\Autodesk\Maya2013\include" /I{our engine include} /Zi /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "NT_PLUGIN" /D "REQUIRE_IOSTREAM" /D "_WINDLL" /Gm- /EHsc /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fp*{pch file output}* /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /TP
/analyze- /errorReport:prompt
2005 linker
/OUT:{dll output file} /NOLOGO /LIBPATH:"C:\Program Files (x86)\Autodesk\Maya2013\lib" /DLL /MANIFEST /MANIFESTFILE:{manifest output file} /NODEFAULTLIB:"libcmt.lib" /DEBUG /PDB:{pdb file} /MAP /IMPLIB:{import library} /ERRORREPORT:PROMPT Opengl32.lib pnglib_d.lib zlib_d.lib libeay32.lib ssleay32.lib Foundation.lib OpenMaya.lib OpenMayaUI.lib OpenMayaAnim.lib OpenMayaFX.lib OpenMayaRender.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib { project libs compiled with VS2005 .sln file }
/subsystem:windows /dll /incremental:yes /debug /export:initializePlugin /export:uninitializePlugin
2010 linker
/OUT:{dll output file} /NOLOGO /LIBPATH:"C:\Program Files (x86)\Autodesk\Maya2013\lib" /DLL "Opengl32.lib" "pnglib_d.lib" "zlib_d.lib" "libeay32.lib" "ssleay32.lib" "Foundation.lib" "OpenMaya.lib" "OpenMayaUI.lib" "OpenMayaAnim.lib" "OpenMayaFX.lib" "OpenMayaRender.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /NODEFAULTLIB:"libcmt.lib" /MANIFEST /ManifestFile:{manifest output file} /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:{pdb output file} /MAP /PGD:{pgd output file} /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT
/subsystem:windows /dll /debug /export:initializePlugin /export:uninitializePlugin
Finally figured out the problem!!!!
Followed the "new way" Visual Studio 2010 has project dependancies listed. http://manski.net/2011/11/project-dependencies-in-visual-c/
This solved the "unresolved symbol" issues but created this error:
error MSB4006: There is a circular dependency in the target dependency graph
I solved this via the instructions here https://connect.microsoft.com/VisualStudio/feedback/details/534361/better-error-message-for-output-circular-dependency#details
Hope this saves someone a lot of trouble.

VC11 LNK1107 referencing a header file

So I've looked for almost 2 days now for a solution to my problem, but everyone else getting this error seems to be linking against a dll instead of a lib. However, that doesn't seem to be the case for me, so here I am.
I'm trying to build a project in Visual Studio 2012 using the vc110 (VS2012) toolchain. However, whenever I build the project, I get the following linker error from the build log (detailed verbosity):
1>Task "Link"
1> Environment Variables passed to tool:
1> VS_UNICODE_OUTPUT=1344
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgr.exe" /INCREMENTAL /NOLOGO /LIBPATH:S:\twk_amf\Implementation\EditorServiceMgr\proj\Win\vc9\..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\..\..\..\..\..\..\external\Trolltech_Qt4\lib\win\x64\Debug msvcrtd.lib QtCored4.lib QtGuid4.lib QtXmld4.lib QtNetworkd4.lib QtUiToolsd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcp.lib /NODEFAULTLIB:libcpd.lib /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libcid.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:libcimt.lib /NODEFAULTLIB:libcimtd.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgr.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgr.lib" /MACHINE:X64 ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.h
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.rc
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.res
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgrSvc.dll
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgr.res
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.obj
1> Tracking command:
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\Tracker.exe /a /d C:\Windows\Microsoft.NET\Framework\v4.0.30319\FileTracker.dll /i S:\twk_results_win\ViewLocal\x64\MC_inter\EditorServiceMgr\Debug /r "S:\TWK_RESULTS_WIN\VIEWLOCAL\X64\MC_INTER\EDITORSERVICEMGR\DEBUG\EDITORSERVICEMGR.RES|S:\TWK_RESULTS_WIN\VIEWLOCAL\X64\MC_INTER\EDITORSERVICEMGR\DEBUG\EDITORSERVICEMGRSVC.H|S:\TWK_RESULTS_WIN\VIEWLOCAL\X64\MC_INTER\EDITORSERVICEMGR\DEBUG\EDITORSERVICEMGRSVC.OBJ|S:\TWK_RESULTS_WIN\VIEWLOCAL\X64\MC_INTER\EDITORSERVICEMGR\DEBUG\EDITORSERVICEMGRSVC.RC|S:\TWK_RESULTS_WIN\VIEWLOCAL\X64\MC_INTER\EDITORSERVICEMGR\DEBUG\EDITORSERVICEMGRSVC.RES|S:\TWK_RESULTS_WIN\VIEWLOCAL\X64\MC_OUT\DEBUG\EDITORSERVICEMGRSVC.DLL" /b MSBuildConsole_CancelEvent31ad2214810446c299127f83382c747d /c "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\link.exe" /ERRORREPORT:PROMPT /OUT:"..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgr.exe" /INCREMENTAL /NOLOGO /LIBPATH:S:\twk_amf\Implementation\EditorServiceMgr\proj\Win\vc9\..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\..\..\..\..\..\..\external\Trolltech_Qt4\lib\win\x64\Debug msvcrtd.lib QtCored4.lib QtGuid4.lib QtXmld4.lib QtNetworkd4.lib QtUiToolsd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcp.lib /NODEFAULTLIB:libcpd.lib /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libcid.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:libcimt.lib /NODEFAULTLIB:libcimtd.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgr.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgr.lib" /MACHINE:X64 ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.h
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.rc
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.res
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_out/Debug\EditorServiceMgrSvc.dll
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgr.res
1> ..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.obj
1>..\..\..\..\..\..\twk_results_win/ViewLocal/x64/MC_inter/EditorServiceMgr/Debug\EditorServiceMgrSvc.h : fatal error LNK1107: invalid or corrupt file: cannot read at 0x5F2
1> The command exited with code 1107.
1>Done executing task "Link" -- FAILED.
From the build output, I thought that the linker might be trying to link against a header file, but I haven't been able to find any evidence of that.
The file referenced here, EditorServiceMgrSvc.h, only contains macro definitions, no includes. The header file is also referenced in the rc file, and is included as a symbol header file. Furthermore, there are only libs within the additional dependencies of the project's property pages.
I will put up what I can in addition to the build output, if needed, but I may not be able to put up that much since I'm working on proprietary code. Any ideas of what's happening here?
EDIT:
Note that this project was auto-converted from Visual Studio 2008 project format.