I download SDL source at \'https://www.libsdl.org\'
I use cmake and get library.
libSDL2.a libSDL2main.a libSDL2-2.0.so libSDL2-2.0.so.0 libSDL2-2.0.so.0
You must add -lpthread before other libs to link threading support.
-lpthread
You should also enable a bit more warning option: -Wextra -pedantic
-Wextra
-pedantic
So
gcc -W -Wall -Wextra -pedantic -o main main.c -Iinclude -lpthread -Llib -lSDL2 -lSDL2main