I'm trying to create a windows application and statically link to the CRT. I'm getting this error,
LINK : error LNK2001: unresolved external symbol WinMainCRTStartup
I'm compiling with this command line
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl.exe" /c main.cpp /O2 /I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" /I"C:\Program Files (x86)\Windows Kits\8.1\include\um" /I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" /I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\Include" /DWIN32 /D_WINDOWS /Zi /MT /nologo
and linking with this command line
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\link.exe" user32.lib libcmt.lib kernel32.lib main.obj crt_win64.obj /SUBSYSTEM:WINDOWS /DEBUG /nologo /MACHINE:x64 /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\Lib"
As you can see I'm using the /MT switch on the compiler and using the /SUBSYSTEM:WINDOWS switch on the linker.
I'm also linking to libcmt.lib.
The signature of my main function is
int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
What am I missing?
VC\Lib\amd64
in library path for x64 build – Pless