Wayde Gardiner
Wayde Gardiner

Reputation: 11

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

I'm having some issues getting a CHIP-8 interpreter to compile. Upon pressing ctrl+f9 to compile I am met by a message saying "Build ended with errors. Continue?".

Checking the build log reveals the following error: C:/Workspace/****/****/main.c:4:17: fatal error: sdl.h: No such file or directory

I have tried copying SDL.h into the source directory, that did not work.

I tried making a directory in source called "SDL" (src/SDL/SDL.h), did not work.

I also tried making a folder next to src, (SDL/SDL.h). That did not work either.

After that I tried #include <.SDL.h>, #include <.sdl.h>, #include <.SDL.dll> and #include <.sdl.dll> (ignore the period after the "<" symbol)

I have also tried copying over the files for SDL version 1.2.15 and SDL version 2.0.3. That did work either.

Am I doing something fundamentally wrong? How do I get this to compile?

Upvotes: 0

Views: 14549

Answers (2)

askmish
askmish

Reputation: 6674

Here's a step-by-step on how to get SDL1.2.5 working with codelite:

  1. Download the "Development Libraries" from here
  2. Extract the tar.gz file contents to a directory. For eg: C:\mysdl
  3. In codelite, right-click over the project's name in the "Workspace View"
  4. From the context menu, select "Settings..."
  5. The 'Project Settings' dialog will appear.
  6. In the "configuration Type" choose "Debug" or "Release", based on your requirements. You can also, do the following steps for both Debug and Release.
    • Go to "Compiler" tab
      • In "Additional Search Path", add the path where all the sdl include files are. For eg: C:\mysdl\include
    • Go to "Linker" tab
      • In "Library Path", add you lib path eg: C:\mysdl\lib\
      • In the "Options" append -lSDL -lSDLmain -lmingw32 -mwindows(case-matters)
  7. Copy C:\mysdl\bin\SDL.dll to C:\WINDOWS\SYSTEM32 or if 64-bit C:\Windows\SysWOW64
  8. When including headers you must use #include "SDL\SDL.h" or #include "SDL.h" depending on how you configure your directory structure.

Upvotes: 1

Bastien Durel
Bastien Durel

Reputation: 613

You have to say your compiler where sdl.h lives, with -I/path/to/sdl switch on gcc or filling Include Path in msvc

(don't move it, as it (sdl.h) will probably needs other header files)

Upvotes: 1

Related Questions