Problem with SDL | Can't install/prepare it

Hello, I have a problem with compiling my SDL code in Dev-Cpp
I did all the instructions from http://lazyfoo.net/SDL_tutorials/lesson01/windows/devcpp/index.php
The code was:

#include "SDL/SDL.h"

int main( int argc, char* args[] )
{
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Quit SDL
SDL_Quit();

return 0;
}

And i couldn't compile, it gave me the following error:

SDL/SDL.h: No such file or directory
compilation terminated.

EDIT: Redownloaded, now that error is gone, but now I'm left with this:
cannot find -lSDLmain
cannot find -lSDL
Last edited on
I can't follow along myself, but I think there might be confusion between L and I (and uppercase vs lowercase).

-I is for "Include", it's for adding a search directory for header files.
e.g. -IC:\mylib\include
-L is for linking a library directory path.
e.g. -LC:\mylib\lib

Actually specifying the library itself is done with -l (lowercase L)
e.g. -lSDL.dll should link to libSDL.dll.a.

I downloaded that mingw tar file, and it looks like in SDL-1.2.15/lib/, there are 2 important files: libSDL.dll.a, and libSDLmain.a

In Dev-C++, under Directories --> Libraries, I'm guessing here, but it looks like the interface wants you to include the full path to the file.
Try changing this to:

C:\{sdl dir}\lib\libSDL.dll.a
C:\{sdl dir}\lib\libSDLmain.a


Note: One thing the article suggests doing is copying things into system32. Preferably do NOT ever copy things into system32, it will only bite you in the butt later.
Last edited on
Read those instructions more carefully. The letter between the dash and the "SDL" is a lower case L, not an upper case i.

-I<some path> tells the compiler "look for includes in this directory, beside the directories you already know about".
-l<some name> tells the linker "link this library into the executable to resolve missing symbols".
Last edited on
@Ganado, i can't specify a file in Libraries, only a folder.
@helios no worries, i copied that line straight out of that guy's site.
Last edited on
I see. In that case, I'm not even sure why Dev-C++ is making the command be -ISDLmain, because it should be -lSDLmain like helios said. I think some configuration is going in the wrong place. Do dev C++ projects have a project file that's in XML or some other human-readable format? Would you be able to open it in in notepad (or notepad++) and copy the contents of your project file here?

(Edit: I see now, at the bottom of the page it shows the linker options to put in directly).
Last edited on
Oh, that's my mistake, i was rewritting the bug, not copying it.
In devcpp it's obviously l, not I.
Edited it now.
You, uh, should be installing SDL2, not working with the old SDL.

http://lazyfoo.net/tutorials/SDL/index.php
Topic archived. No new replies allowed.