Jump to content
  • Advertisement
Sign in to follow this  
Chrono1081

Completely Stumped: Some type of header file issue.

This topic is 3525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!