Sign in to follow this  

SDL.h: no such directory found

This topic is 1267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I set up SDL on my compuer with Code Blocks. But There was an error that said: "fatal error: SDL.h: No such file or directory"

 

Here an image of the error: http://i.imgur.com/4fvBNFw.png

 http://i.imgur.com/aPGmZT2.png

http://i.imgur.com/xkJLco5.png

http://imgur.com/aPGmZT2,xkJLco5,kEgaRqg#2

Edited by GearTreeEntertainment

Share this post


Link to post
Share on other sites
Quickfix:
[tt]#include "SDL/SDL.h"[/tt]

Double check your directories; you've a search directory, "C:\Users\sarmeanu\DOCS\SDL\include\", but SDL.h is located at "C:\Users\sarmeanu\DOCS\SDL\include\SDL\SDL.h". Edited by fastcall22

Share this post


Link to post
Share on other sites

Guys thanks I fixed the issue

 

Care to share, just so this thread isn't totally useless and other people coming across it in the future can hope to fix their problem too?

Edited by Bacterius

Share this post


Link to post
Share on other sites
Here is my folder structure:

C:\SDL2\bin
include
lib

These folders came from "i686-w64-mingw32" not "x86_64"
Codeblocks setup:
Linker settings -> other linker options: -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer

Search directories - Compiler:
C:\SDL2\include\SDL2
C:\SDL2\SDL2_image-2.0.0\i686-w64-mingw32\include\SDL2
C:\SDL2\SDL2_mixer-2.0.0\i686-w64-mingw32\include\SDL2

Search directories -Linker:

C:\SDL2\lib
C:\SDL2\SDL2_image-2.0.0\i686-w64-mingw32\lib
C:\SDL2\SDL2_mixer-2.0.0\i686-w64-mingw32\lib

//main.cpp
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>

Should work perfectly fine.

Share this post


Link to post
Share on other sites

Quickfix:
[tt]#include "SDL/SDL.h"[/tt]

Double check your directories; you've a search directory, "C:\Users\sarmeanu\DOCS\SDL\include\", but SDL.h is located at "C:\Users\sarmeanu\DOCS\SDL\include\SDL\SDL.h".

Note that it's SDL2/SDL.h in the case of SDL 2.0 (saying this in case somebody else looks at that post).

 

And yeah, that seems to cause trouble a lot of time. The documentation insists that one should use "SDL.h", but I have tried that in the past and the compiler becomes unable to find the header. In the end I use <SDL2/SDL.h> and it works just fine. I think the issue is that the documentation assumes you're using pkg-config (which will add the SDL headers directory to the include list).

Share this post


Link to post
Share on other sites

This topic is 1267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this