-3

i'm trying to use SDL with my c project actualy it's a multi file project connected to each other so when i installed sdl i found a problem that sdl doesn't connect with other files it only connect with main and i find this error C:\Users\EYAOSM~1\AppData\Local\Temp\ccoI9IBj.o:main.c:(.text+0x7): undefined reference to `lstcltcreer' with all the functions i have outside of main in the other files

i used this to connect sdl to main

C:\Users\Eya Osmane\Desktop\prooooojjjjj>gcc src/*main.c -o bin/prog -I include -L lib -lmingw32 -lSDL2main -lSDL2

this is the structure of my program

src contains the main and the other files i wrote

and the other files bin include lib and obj are sdl files

and all these files are plased in projjjjj which is in my desktop

Eya Osmane
  • 19
  • 8

1 Answers1

1

Your problem has nothing to do with SDL.

You just need to pass to GCC the list of .c file your project uses. This can be done with the wildcard (*) operator.

gcc src/*.c -o bin/prog -I include -L lib -lmingw32 -lSDL2main -lSDL2

Or by explicitely including the files

gcc src/a.c src/b.c src/main.c -o bin/prog -I include -L lib -lmingw32 -lSDL2main -lSDL2

Maxime B.
  • 1,116
  • 8
  • 21