I was running a batch script and having it delete the exe before compile, so I could then check for the compiled exe after compilation before running the exe:
pushd build
del win32_handmade.exe
cl -FC -Zi ..\code\win32_handmade.cpp user32.lib Gdi32.lib
IF EXIST "win32_handmade.exe" call "../build/win32_handmade.exe"
Of course, using @REM
to comment out the line that delete the exe would work, but that's not even really a solution:
@REM del win32_handmade.exe
One way I found to get around the error message: when you delete the .exe, you can avoid the warning message by also deleting any .ilk, which contains the linking data:
del win32_handmade.exe
del win32_handmade.ilk
So far, the best solution I've found is to disable incremental linking. You can do this by adding /link /INCREMENTAL:NO
to the end of your cl command, like so:
cl -FC -Zi ..\code\win32_handmade.cpp user32.lib Gdi32.lib /link /INCREMENTAL:NO