0

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?

6
  • Thank you Bastien Durel for your quick response. Commented Jun 30, 2015 at 13:09
  • How did you install SDL in your system? Is it a windows or linux? which IDE? Commented Jun 30, 2015 at 13:11
  • I downloaded SDL, I don't understand how to install it. I am running windows 10, technical preview and the IDE I am using is CodeLite I tried adding -I/C:/Users/****/Desktop/SDL-1.2.15/include/SDL to the list of switch statements, but it does not appear to be working. The compiler I am using is MinGW ( TDM-GCC-32 ) Commented Jun 30, 2015 at 13:15
  • I added the path in the include statement and now it is no longer throwing the error stating that it was not found. Just a whole lot more, different errors. I am going to try SDL2 and see if it does the same thing. Commented Jun 30, 2015 at 13:19
  • 1
    SDL2 throws less errors, so I started replacing bits of code with NULL to see if I could get it to compile. Upon typing my second NULL, codelite proceeded to lock up. Should I just give up and go back to FreeBasic? Commented Jun 30, 2015 at 13:26

2 Answers 2

1

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)

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

I'm pretty sure this person doesn't use Codelite.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.