A setup of SDL2 with all the libraries available in the project folder.
To compile the program use:
make
To run it:
./bin/main
To clear compiled files:
make clean
Tip
If VS Code is not detecting the path to SDL add them to the path by adding "${workspaceFolder}/include"
in the Microsoft C/C++ Extension.
The Zed editor might have difficulties finding SDL2 in the include folder. To fix this, you'll need to use absolute paths in your .clangd
file. To get the absolute path:
- Change directory to your project folder
- Use
pwd
to get the absolute path - Create a
.clangd
file in your project root that looks similar to this:
CompileFlags:
Add:
- "-I/Users/username/Projects/my-project"
- "-I/Users/username/Projects/my-project/include"
- "-I/Users/username/Projects/my-project/include/SDL2"
Replace /Users/username/Projects/my-project
with the output from your pwd
command.