Completely Stumped: Some type of header file issue.

Started by
4 comments, last by Chrono1081 15 years, 3 months ago
Recently I reinstalled everything on my computer, re-setup visual studio, re-setup SDL according to lazyfoos instructions, I load up some of my SDL projects only to find that in the very first line: #include "SDL/SDL.h" has to be changed to: #include "SDL.h" or else nothing will run and it comes up with an error saying "SDL/SDL.h could not be found". My question is anyone know what I screwed up? My projects seem to run just fine with only "SDL.h" but am I maybe missing something that will give me trouble later? I restepped through lazyfoos tutorial countless times and still end up with needing to use only "SDL.h". Any help would be greatly appreciated :)
Advertisement
When you extracted SDL's header files, you either extracted them to your project directory, or straight into Visual Studio's include directory. What you probably wanted to do was to extract them into a include/SDL directory instead.
*slaps forehead* Thank you Steve! You nailed it right on the head. Will it make a difference at all which way I have it set up?
Quote:Original post by Chrono1081
*slaps forehead* Thank you Steve! You nailed it right on the head. Will it make a difference at all which way I have it set up?
For libraries like SDL, it's usually preferable to have the headers files in the IDE paths rather than your project path, since then the library can be used from multiple projects without needing multiple copies.

So far as "sdl.h" VS "sdl/sdl.h" goes, personally I prefer the second, since it keeps SDL seperate from the "core" include files like stdio.h and so on. There's not really any functional difference that I know of.
It would help when you start writing more complicated code. You might, for instance, have your own vector class for position vectors. If you don't put it into another folder and instead use a

#include <vector.h>

It would interfere with the STL implementation as both of them would be in the compiler's include directories (at the base)

Thats the basic idea I guess. Thats why most of the general lower-level libraries make a generalisation - it might be faintly probable that you have another glut.h, so why even take a chance.
Thank you guys for the responses :) I've made the changes so that SDL is separate now.

This topic is closed to new replies.

Advertisement