Originally Posted by tuxdev
Use #include "SDL.h", not #include "SDL/SDL.h". The SDL docs will confirm it.
For most anything, compile the separate .o files before linking because it helps with not having to recompile the whole file just because of a linker error.
Sample makefile that I use for one of my play programs.
CC = gcc
CFLAGS = `sdl-config --cflags` -g -Wall
&tab;$(CC) `sdl-config --libs` -o maze maze.o
I tried this, but to no avail. Interestingly, the error I got may shed some light on the problem. When i change my #include to "SDL.h" instead of "SDL/SDL.h", I got this error:
src/Main.cpp:8:17: error: SDL.h: No such file or directory
src/Main.cpp: In function 'int main(int, char**)':
src/Main.cpp:237: error: 'SDL_INIT_EVERYTHING' was not declared in this scope
src/Main.cpp:237: error: 'SDL_Init' was not declared in this scope
As opposed to the error I got with "SDL/SDL.h",
src/Main.o: In function `main':
.text+0x11da): undefined reference to `SDL_Init'
collect2: ld returned 1 exit status
I think this shows that #include "SDL.h" works as it recognises SDL_INIT_EVERYTHING, just not the function it is used in.
Just an idea. And btw thanks everyone for trying to help me!