fatal error: SDL.h: No such file or directory - SDL_ttf.h can't use SDL.h (and possibly neither can main.cpp)

This is fortunately hopefully a pretty easy problem. Basically, the compiler throws a fatal error my way whenever I try to compile my program - it can't access SDL.h. Since it's a fatal error (and if I understand the term 'fatal error' correctly, that means it stops trying to compile), I suspect that main.cpp should have the same problem if only SDL_ttf.h and not main.cpp were given access to SDL.h somehow. Here's my main.cpp:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <SDL/SDL.h>
#include "SDL_ttf.h"

int main ( int argc, char** argv )
{
    if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
        return false;
    }
    TTF_Init();
    TTF_OpenFont(NULL, 0);
    TTF_Quit();
    SDL_Quit();
}


And here's the include statement for SDL.h in SDL_ttf.h:

 
#include "SDL.h" 


I can include all of SDL_ttf.h if necessary, but I don't believe I made any changes, sooooo probably not necessary.

For some reason, when I try to compile this, SDL_TTF.h spits out an error:

fatal error: SDL.h: No such file or directory

And while I've fiddled with it for a while to try and get it working, I haven't really found anything that works. I have -lSDL_ttf set as a complier option and I have /usr/include added under Settings->Compiler->Linker Settings->Link Libraries, which, to the best of my knowledge, should allow SDL_ttf.h (and anything else) access to any library installed via the package manager.

Am I missing something? I'm sure it's just some stupid little error somewhere (as most of my problems are), but I've been trying to figure it out for quite a while now and just can't get it.

Thanks in advance for the answers to my probably ridiculously simple question :p
Add `sdl-config --cflags` to your compiler flags and `sdl-config --libs` to your linker flags. If you are using SDL 2 use sdl2-config instead of sdl-config.
Sorry for the ridiculously late reply, and thank you very much for the answer.

I went under Settings->Compiler->Compiler Settings->Other Options and added `sdl-config --cflags`(including the goofy ` symbols - before I included them it gave me some trouble, I guess it's a g++ peculiarity). I also went to Settings->Compiler->Linker settings->Other linker options and added `sdl-config --libs`.

Aaaaand it's still giving me the same error. I honestly don't know what's up with it. Ideas?.........

EDIT: I have checked to make sure that the file is there (it's in /usr/include/SDL) and I actually tried including the full filepath like so:
#include "/usr/include/SDL/SDL.h"

And no difference. It's not finding the file, even though it's obviously there.
Last edited on
Guys halp. I replaced (in SDL_ttf.h)
#include "SDL.h"
with
//#include "SDL.h"
and it still gave me the same error. I'm so confuzzled, how could it be that the error isn't in that line? I can't see anywhere else the problem could be, especially since main is apparently having no trouble with SDL.
Topic archived. No new replies allowed.