Seeing this finally gave me reason to create a forum account!
So, I've also been using SDL2 to implement my 'platform-layer' atop windows,
mainly to get to use my gamepad wich does not use XInput and I couldn't be bothered with DirectInput.
Anyway, here's how I compile (x64!): (build.bat)
set EXPORTS=-EXPORT:GameGetSoundSamples -EXPORT:GameUpdateAndRender
if not defined DevEnvDir (
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
set CommonCompilerFlags=-MD -nologo -Gm- -GR- -EHa- -Od -Oi -WX -W4 -wd4201 -wd4100 -wd4189 -wd4505 -FC -Z7 /I%Pincludes% -DHANDMADE_SLOW=1 -DHANDMADE_INTERNAL=1
set CommonLinkerFlags=/incremental:no /opt:ref /LIBPATH:%Plibs% SDL2.lib SDL2main.lib
del *.pdb > NUL 2> NUL
cl %CommonCompilerFlags% ..\code\handmade.cpp -Fmair.map -LD /link /subsystem:windows,6.1 /incremental:no %PDBLockPrevention% %EXPORTS%
cl %CommonCompilerFlags% ..\code\sdl_handmade.cpp -Fmsdl_handmade.map /link /subsystem:console %CommonLinkerFlags%
Dir-layout is: (where x: is a subst to the full folder path)
x:\build -> stuff gets built here
x:\code -> code here
x:\ext_libs -> this is where SDL2 for VC goes (SDL2-devel-2.0.3-VC.zip)
\include -> SDL2 headers
\lib\x64 -> arch specific *.lib files
\lib\x86 -> "
Obviously you need to place a copy of SDL2.dll in the 'build' dir for your executable to use when run.
Note that I don't need to use the -entry flag and can have a normal 'int main(...)'.
The '/subsystem:console' is only there so that I could see 'printf()' output, which if wanted could also require 'User32.lib' on the 'commonLinkerFlags' line and the stdio.h include in the code!