So I'm currently using Lazy Foo's tutorials. Here's the link:

http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet05e/index.php

I followed all the instructions, but I'm having a couple issues.

So when I choose an empty project, like the tutorials recommends, as opposed to one with a precompiled header, the C/C++ tab does not appear, and I am unable to manipulate all of the options. This is peculiarity number 1. I think it may have to do with the fact that the tutorial is designed for VC++ 2005, but I am using VC++ 2008.

Anyways, both when I choose an empty project and when I do not, I receive the same compiling error.

Here is my code.

// SDL.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "SDL/SDL.h" 

int main( int argc, char* args[] ) 
{ 
	//Start SDL 
	SDL_Init( SDL_INIT_EVERYTHING );

	//Quit SDL 
	SDL_Quit();

	return 0; 
}

Here is the error that I am getting.

1>------ Build started: Project: SDL, Configuration: Debug Win32 ------
1>Compiling...
1>SDL.cpp
1>c:\program files\microsoft visual studio 9.0\vc\include\sdl\sdl_stdinc.h(594) : fatal error C1083: Cannot open include file: 'close_code.h': No such file or directory
1>Build log was saved at "file://c:\Users\Nick\Documents\Visual Studio 2008\Projects\SDL\SDL\Debug\BuildLog.htm"
1>SDL - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Could this mean that I didn't link something properly or that I didn't copy and paste the SDL files into the Visual Studio lib folder properly? I'm not really sure.

Thank you for the help.

>>fatal error C1083: Cannot open include file: 'close_code.h': No such file or directory
It means exactuly what it says it means. The compiler can't find close_code.h ?

If I remember correctly the Foo tutorials instruct you to get the pre-compiled binary DLLs.

It should have come with some header files. Did you put them in the include path? Did you tell VC++ where to find the lib files? Did you link with the SDL DLL?

When I first setup SDL I had to go through the includes and remove start_code.h / end_code.h from the includes. Bah.

hmm. I was able to remove and then redownload and reextract the begin_code.h / close_code.h headers. This solved my problem. Thanks for the help.

I know this thread is solved, but i've recently had alot of problems with SDL and visual 2008 c++ express. So heres some other things that may pop up, for the benefit of others looking at this post:

1.

#include "SDL/SDL.h"

This may be wrong. try setting it to plain old:

#include "SDL.h"

does that work?


2.

For any libraries you use, even the main lib or TTF, etc, include its corresponding DLL file (its in the includes file, in the SDL folder there arent many DLL's) in the debug folder of your project.

Does that work?


3.

This bit of code... in a very basic explanation, gets the compiler to check out the lib before using it in the program.

#pragma comment(lib, "SDL.lib")

place this in whatever header file is at the top of your class hierarchy (probs stdafx.h) BEFORE your include statements

Does that work?

Any one of these or all of them combined I hope will solve most problems with setting up SDL....

Thats all i have at the mo... I wont go into how to include libs because there's loads of those already...

HOPE THIS HELPS!! IF IT DID, THEN PAY IT FORWARD AND SEE IF YOU CAN HELP SOMEONE ELSE!!

Edited 6 Years Ago by thriek: TYPO

This question has already been answered. Start a new discussion instead.