Search code examples
c++eclipsesdl

Eclipse SDL.h no such file or directory, everything is linked properly.


For a few weeks now I have been playing around with SDL. But seemingly out of nowhere I cannot create projects with SDL. For example:

#include <iostream>
#include <SDL.h>
using namespace std;

int main(int argc, char* args[]) {


    return 0;
}

returns with the error "fatal error: SDL.h: No such file or directory". This is odd because I am linking it in the exact way as all my other SDL projects (which still run fine).


Solution

  • You have to add the propper folder to you include directories: project properties -> C/C++ General -> Paths and Symbols -> includes -> C++ -> Add

    Add the proper include folder of SDL. Clean project, rebuild index (right click on project) -> index -> rebuild.

    If that does not work, close eclipse and open it again.