These are the contents of my build.bat:
1 2 3 4 5 6 7 | @echo off set CmnCompileFlags = -MT -Gm- -nologo -GR- -EHsc -EHa- -Oi -W4 -wd4201 -wd4100 -FC -Zi -Fmwin32_game.map set CmnLinkerFlags = -subsystem:windows,5.2 -opt:ref user32.lib Gdi32.lib Ole32.lib IF NOT EXIST ..\build mkdir ..\build pushd ..\build cl %CmnCompileFlags% ..\code\win32_game.cpp /link %CmnLinkerFlags% popd |
When trying to run it I receive a bunch of LNK2019 erros such as this one:
win32_game.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp_StretchDIBits в функции "void __cdecl Win32DisplayBufferInWin
However this compiles just fine:
1 2 3 4 5 6 7 | @echo off set CmnCompileFlags = -MT -Gm- -nologo -GR- -EHsc -EHa- -Oi -W4 -wd4201 -wd4100 -FC -Zi -Fmwin32_game.map set CmnLinkerFlags = -subsystem:windows,5.2 -opt:ref user32.lib Gdi32.lib Ole32.lib IF NOT EXIST ..\build mkdir ..\build pushd ..\build cl %CmnCompileFlags% ..\code\win32_game.cpp /link -subsystem:windows,5.2 -opt:ref user32.lib Gdi32.lib Ole32.lib popd |
Yes, I checked if compiler flags were in effect.
I also tried moving -subsystem:windows,5.2 and -opt:ref ouside %CmnLinkerFlags% to see if that would help. It seems that linker just doesn't see any libraries inside of a variable.
I would really like to know what is going on here and whether there is a workaround.