I am trying to teach my self C and how to use the SDL2 library with it. I Run Windows 10 but I have been using Cygwin for C coding and compiling. All my previous test programs ran on the command line, but this is my first test program for the SDL2 library and I got a lot of errors when I tried compiling it:
Here is my code:
#include <stdio.h>#include <SDL2/SDL.h>int main(int argc, char *argv[]){SDL_Init( SDL_INIT_EVERYTHING );SDL_Quit();return 0;}
I then tried to compile it by writing "gcc -o graphics_test graphics_test.c"I get this error:
$ gcc -o grahics_test graphics_test.c/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cce2s09B.o:graphics_test.c:(.text+0x1a): undefined reference to
SDL_Init' /tmp/cce2s09B.o:graphics_test.c:(.text+0x1a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
SDL_Init'/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cce2s09B.o:graphics_test.c:(.text+0x1f): undefined reference toSDL_Quit' /tmp/cce2s09B.o:graphics_test.c:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
SDL_Quit'collect2: error: ld returned 1 exit status
I've tried reading other threads that relate to this problem, but none of them make much sense to me. The potential problems other people seemed to have that may or may not apply to me, is that I am running a 64 bit system. And maybe I installed the 32 bit version of SDL2 for Cygwin?
Also maybe I didn't compile things properly by not linking to the SDL2 library properly?
Lastly I read some people talking about make files, but I don't know what those are.
Sorry for the noob question. I'm very new to C and have only used higher level languages before.