2

When i try to include SDL, it prints an error:

error: SDL.h: No such file or directory

My system is Mac OSX Lion and i´ve installed SDL.

I use this:

#include "SDL.h"
2

Specify the include directory of the SDL.h header to gcc with the option -I.

For example:

gcc -I/usr/include/SDL -c test.c 
3
  • 1
    And it's better practice to use #include <...> if the header isn't part of your source. – James McLaughlin Feb 19 '12 at 15:18
  • 1
    @HackWeb you have to replace the /usr/include/SDL directory in the example with the directory in YOUR system where SDL.h is installed. The find command is your friend. – ouah Feb 19 '12 at 15:24
  • I know this is controversial, but I would instead use #include <SDL/SDL.h> and assume the SDL include directory is located somewhere in the default include path. If it's not, it would be reasonable to expect the person building the project to add the necessary -I options manually or via a configure option. – R.. GitHub STOP HELPING ICE Feb 19 '12 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.