Page 1 of 1

Issues with SDL and VC++ 2008

Posted: Sat Nov 21, 2009 10:35 am
by TheFinalFanatic
Well, I already have SDL set up and working for Dev-C++ (using the devpak) but have decided I would like to use VC++. So, I've followed the tutorial on Lazy Foo's website word for word, but I get still get the error "fatal error C1083: Cannot open include file: 'SDL.h': No such file or directory".

I have checked the following things, and they all appear to have been done correctly:

Added the paths to lib and include folders to the VC++ Directories in the Options window.
Gone to the Project Properties window and: set 'Detect 64-bit Portability issues' to No, set 'Runtime Library' to 'Multi-threaded DLL(/MD), under the Linker tab added 'SDL.lib' and 'SDLmain.lib' to the Additional Dependencies and set the subsystem to 'Windows (/SUBSYSTEM:WINDOWS)'.
Placed SDL.dll in my project's directory.

The code im trying to compile to test it with is as follows, I don't think theres any problems here (SDL.h is not in a seperate folder and so does not need to be SDL/SDL.h)

Code: Select all

#include "SDL.h"

int main( int argc, char* args[] )
{
	SDL_Init( SDL_INIT_EVERYTHING ); 
	SDL_Quit(); 
	return 0;
} 
And still, the error occurs. Maybe I'm just missing something? Some advice would be much appreciated.

Re: Issues with SDL and VC++ 2008

Posted: Sat Nov 21, 2009 11:32 am
by Joeyotrevor
Did you add the folder with SDL.h to your compiler's include directory, and add the folder with SDL.lib to the library directory?

Steps 3 and 4 here:
http://www.lazyfoo.net/SDL_tutorials/le ... /index.php

Re: Issues with SDL and VC++ 2008

Posted: Sat Nov 21, 2009 12:06 pm
by Falco Girgis
Make sure that your includes aren't actually within another folder like #include "SDL/sdl.h" or something. That's a pretty common mistake.

Re: Issues with SDL and VC++ 2008

Posted: Sat Nov 21, 2009 2:02 pm
by DaveB
Well if you added the Include directory to your VC++ directories then it should be

Code: Select all

#include <SDL.h> and not
 #include "SDL.h"

Re: Issues with SDL and VC++ 2008

Posted: Sat Nov 21, 2009 4:17 pm
by TheFinalFanatic
Did you add the folder with SDL.h to your compiler's include directory, and add the folder with SDL.lib to the library directory?
I had done so, but stupidly added the path for the include folder under the Executable Files, and not the Include ones :lol:

However, even after this I get another, seemingly unrelated error 'error PRJ0003 : Error spawning 'cmd.exe'' and I have absolutely no idea why this would happen.

EDIT: Nevermind, sorted it by adding : '$(SystemRoot)\System32', '$(SystemRoot)' and '$(SystemRoot)\System32\wbem' to the VC++ Directories.