Issues with SDL and VC++ 2008

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
TheFinalFanatic
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 14
Joined: Thu Oct 15, 2009 3:10 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: C#
Location: That place. You know...Yea, that one.

Issues with SDL and VC++ 2008

Post 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.
User avatar
Joeyotrevor
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Thu Jan 22, 2009 6:24 pm
Programming Language of Choice: C++

Re: Issues with SDL and VC++ 2008

Post 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

Code: Select all

eb 0c 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 31 d2 8e c2 30 ff b3 0a bd 02 7c b9 0b 00 b8 00 13 cd 10 eb fe
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Issues with SDL and VC++ 2008

Post 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.
DaveB
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 24
Joined: Sat Nov 21, 2009 1:57 pm

Re: Issues with SDL and VC++ 2008

Post 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"
TheFinalFanatic
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 14
Joined: Thu Oct 15, 2009 3:10 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: C#
Location: That place. You know...Yea, that one.

Re: Issues with SDL and VC++ 2008

Post 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.
Post Reply