Jump to content
  • Advertisement
Sign in to follow this  
MPG

Having trouble with Microsoft Visual c++ and SDL

This topic is 4841 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

My initalitation method will not operate anymore. #ifdef WIN32 #pragma comment(lib, "SDL.lib") #pragma comment(lib, "SDLmain.lib") #endif #include <SDL/SDL.h> #include "stdio.h" bool k; int main( int argc, char* argv[] ) { SDL_Init ( SDL_INIT_VIDEO ) ; atexit(SDL_Quit); SDL_Surface* screen; SDL_Surface* rect; SDL_Surface* square; SDL_Surface* rightangle; SDL_Event event; screen = SDL_SetVideoMode(1024, 768, 32, SDL_DOUBLEBUFF | SDL_ANYFORMAT) c:\Documents and Settings\RandyP\My Documents\Visual Studio Projects\Zero gravity\ZG.cpp(6) : fatal error C1083: Cannot open include file: 'SDL.h': No such file or directory I have tryed to utilize <SDL/SDL> ,but still nothing works.

Share this post


Link to post
Share on other sites
Advertisement
Are you sure you have set up the directories correctly?
I am using MSVC6, so if you are using a different version, this may not work, but try going to Tools->Options->Directories. There is a combo box, that says "Show directories for:" -- make sure it is set to "Include Files." Add to that list the directory in which the SDL include files are. For example, for me, it is "C:\Base\Code\SDL\include."
Then try doing #include "SDL.h" -- with quotes.
Hope that helps.

Share this post


Link to post
Share on other sites
If you went to Tools - Options - Directories, and added the SDL/include directory, then #include "SDL.h" should work.

Also, you can change "stdio.h" to <stdio.h"

Share this post


Link to post
Share on other sites
#include <SDL.h>

Right click Project name on the bar to the side and click properties ( not the solution ), go to Linker and Input and under additional dependancies put this: sdl.lib sdlmain.lib

I don't know if you have your IDE set up for SDL, so you also may have to do this:

Tools > Options > Projects > VC++ Directories

Select show directories for Include files in the drop down box toward the top right of the window. Add ...\SDL-1.2.8\include or wherever your SDL include folder is, in place of the ... put the folders its in, for example I have D:\dev\Libraries\SDL-1.2.8\include

Next select show directories for Library files and then for example D:\dev\Libraries\SDL-1.2.8\lib is what I have, so just put whatever folders the lib folder is under. Then click Ok and you should be fine.

Hope this helped.

Edit:

Also get rid of this ugly stuff. The instructions I gave you will allow you to skip this. However you will have to set the Additional Dependancies again for each project.

#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#endif

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!