The goal is to have a lightweight working SDL2 dev environment under windows. It will use g++ builder and the ucrt64 flavor of SDL. They both are available in the msys2 tool chain and can be easily install with minimal effort.
- msys64 [https://www.msys2.org/]
- VScode [https://code.visualstudio.com/]
- Install msys2 (I use the default location from here: "C:/msys64") and launch msys64.exe
- Use pacman in msys64 terminal to get the required build tools and SDL:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
pacman -S mingw-w64-ucrt-x86_64-SDL2
- Add msys2 bin location to your User Environment Path:
C:/msys64/ucrt64/bin
- Install VScode
- Install c/c++ extension pack within VScode
In order to make VScode use the project build & launch settings you have to excplicitely open the project folder in VScode.
Make sure the following are setup like this:
- c_cpp_properties.json (generated by c/c++ extension)
Add to include path:
"C:/msys64/ucrt64/include/"
Set "compilerPath":
"C:/msys64/ucrt64/bin/g++.exe"
- tasks.json (generated after trying to build with VScode)
Set "command":
"C:/msys64/ucrt64/bin/g++.exe"
Add after -o in "args":
"-lSDL2"
"-lSDL2main"
- launch.json (generated after first "run & debug (ctrl+shift+D)")
Set "miDebuggerPath":
"C:/msys64/ucrt64/bin/gdb.exe"