SDL 2 Tutorial Windows and Visual Studio Code Setup | Visual Studio Code, Game Dev

Sonar Systems · 150K views · 2022 · 15:13

Open on YouTube

Game programming & enginesTesting, debugging & developer toolsC, C++, Rust, Go & systems languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it as the setup guide they followed, usually when their SDL2 include or linker errors on Windows and VS Code come from steps in this walkthrough.

Recommended by 1 people across 1 different months, 2022 to 2025.

What it is

A 15-minute tutorial from Sonar Systems showing how to set up SDL 2 on Windows with Visual Studio Code, using MinGW and a Makefile. It covers downloading SDL, placing include and lib folders in the project, and building a first window.

What people said

Recommends Dec_Ves · 2025-01 · Stack Overflow · on “Linker can't find mingw64 library?”

@Someprogrammerdude I was following this tutorial to set up SDL2 with VScode and he told me to add this to the makefile [this video]

Cites HelpersCoockies · 2022-09 · Stack Overflow · on “How do I fix this error SDL2/SDL.h: No such file or directory?”

so I am trying to install SDL2 for c++ and I always get the error fatal error: SDL2/SDL.h: No such file or directory I followed this tutorial: [this video] . I already looked up several stack overflow questions and other websites but none of them could help me. For this line I get an error: #include <SDL2/SDL.h> This is how I set up all files in the working directory. working directory [LINK] In the include path I have those lines ${workspaceFolder}/** ${workspaceFolder}/src/include This is the line I have in the Makefile: all: g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2 In general, cpp works flawless for me. I installed the 64bit version mingw version of SDL2.

Cites aret · 2022-12 · Stack Overflow · on “Undefined identifiers from SDL graphic library”

I am trying to install on my VS Code the SDL ( [LINK] ), cause I am going through book "Will_Briggs_C++20_for_Lazy_Programmers_Quick,_Easy,_and_Fun_C++" which uses SDL. However in book dont use vs code, so I am trying to manage how to install by myself. I followed Youtube Tutorials (example: [this video] ), but got trouble - I included library, added SDL2.dll file, tried to write in Makefile commands, but compiler doesnt recognise every SDL command. Whats wrong? (screenshot in the end) Source files are from Chapter1, folder "ch1\test-setup": [LINK] My main file: #include <iostream> #include "include\SDL2\SDL.h" using namespace std; int main(int argc, char **argv) { // Initial window setup SSDL_Se

Cites Tarou 9000 · 2024-03 · Stack Overflow · on “How can I move my MSYS2 folder to another folder (both in the D driver) if possible?”

My files are quite messy, so I decided to try to organize some program files I use to code C++ in Visual Studio while using the SDL2 library, I've successfully moved ACLib and Gnu, and the code run as expected, I could compile the program. Then I moved the MSYS2 file, when I tried compiling the program, which I do by typing make in a terminal and proceeding to type ./main , it told me: g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2 process_begin: CreateProcess(NULL, g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2, ...) failed. make (e=2): The system cannot find the file specified. make: *** [all] Error 2 I was devastated by the error and

Cites Levi · 2025-07 · Stack Overflow · on “How do I compile with gcc using SDL2 on Windows with a Makefile?”

I was for a while developing an SDL project in code blocks but wanted to transition to instead using VS Code. My experience with compiling my own programs hasn't gone beyond single file, non-dependent programs, for instance something that looks like this in the terminal: C:\...\Hello World>gcc main.c C:\...\Hello World>a.exe Hello World! There are a lot of variables in my question, so I'll first start by addressing my desire to use a Makefile. I came across this post [LINK] and so downloaded chocolatey for windows so that I could use make files. The basic Makefile I made for testing (without SDL) was as follows: build: gcc -std=c99 ./src/*.c -o helloWorld run: ./helloWorld clean: rm helloWor