Not sure how to go about setting up SDL

Hello everyone, I went through SDL installation for linux, I am running an arch distro but tbh I am not very familiar with linux yet.

I unzipped the source zip on usr/local/lib which in hindsight probably wasn’t necessary, then I run configure make and make install and I now see a bunch of files and folders in my lib directory like libSDL2.so or libSDL2.la and some others.

now hoping that everything worked as intended the next step in the installation is to compile my program with
```gcc -o myprogram myprogram.c `sdl2-config --cflags --libs````

which gives me an error sdl.h or SDL.h : No such file or directory
then as a follow up question how do I get it to work in Clion that uses a cmake file to add libraries

edit1: if I remove #include <sdl.h> and not use anything related to sdl I get “cannot find sdl2-config --cflags…”, I see a sdl2-config is in usr/local/bin

The easiest way to install SDL is by using your distro’s package manager (i.e. pacman on Arch Linux).

pacman -S sdl2 sdl2_image sdl2_mixer sdl2_ttf

For packages of other extension libraries see: https://archlinux.org/packages/?q=sdl2

Note that letter case is important on Linux (and on most systems other than Windows). The correct name for the header is SDL.h

Hi Different,

Happy to see that you and Linux are giving each other a chance.

First, please confirm that you have successfully installed SDL2. To check if you have it installed run the following find command:

sudo find / -type d -name SDL2

In case the command does not result in a path within your computer (e.g. /usr/include/SDL2) you may not have successfully installed SDL2.0 yet. To install it try:

sudo apt-get install libsdl2-dev

Now retry the find command.

Once you get the expected result (e.g. /usr/include/SDL2) we move on to the problem you have with the linker flags. To compile your program try with the following command:

gcc  myprogram myprogram.c -g -fPIC -lSDL2

Hope this explanations helps you.

Regards.