Sign in to follow this  
The Thing

SDL - need a little help / info:

Recommended Posts

Hello everybody, I've downloaded and set up SDL on my machine for use with VC++ Express and it does work, however I've just tried compiling some source code from Lazy Foo's site and there is an #include statement - #include "SDL/SDL.h" which is throwing up the following error - Cannot open include file: 'SDL/SDL.h': No such file or directory. I do have a header file called SDL.h located at C:\SDL_1.2.9\include Is the / in the include statement indicating a path to the header file or is it the name of another header file? If I edit the code to read #include "SDL.h" it works OK. Is editing the code OK or should I download from somwhere a file called SDL/SDL.h How do I go about rectifying the follwing error? ------ Build started: Project: SDL_Test, Configuration: Debug Win32 ------ Compiling... SDL_Test_A.cpp Linking... MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

Share this post


Link to post
Share on other sites
Re: Linker error:
How to link with the correct C Run-Time (CRT) library

Perhaps try changing the library you're linking to in: Project > Properties > C/C++ > Code Generation > Runtime Library.

Re: SDL header include cleanup:
It is ok to alter the code so that the includes work with the names you would like to use. I have never put the SDL .h files in an SDL folder. I usually just add my SDL install folder's include and lib folders into the MSVC++ Tools > Options > Projects > VC++ Directories > Include Files / Library Files settings.

Then, like you suggest, simply #include <SDL_opengl.h>, or what have you.

Share this post


Link to post
Share on other sites
I got the same error, and I just changed Project > Properties > Linker > Input > Ignore Specific Library to msvcrt.lib, and it worked.

Share this post


Link to post
Share on other sites
Quote:
Original post by The Thing
I've just tried compiling some source code from Lazy Foo's site and there is an #include statement - #include "SDL/SDL.h" which is throwing up the following error - Cannot open include file: 'SDL/SDL.h': No such file or directory. I do have a header file called SDL.h located at C:\SDL_1.2.9\include
Is the / in the include statement indicating a path to the header file or is it the name of another header file? If I edit the code to read #include "SDL.h" it works OK. Is editing the code OK or should I download from somwhere a file called SDL/SDL.h


It was good to remove the SDL/ from the #include line because now the compiler can see your SDL.h file. The tutorial project might have had this kind of file structure and it then would have been necessary for the "SDL/SDL.h" include.

[code]

(Project Location)
|
+-SDL| |
| +- SDL.h
. +- SDL.lib
. +- SDLmain.lib
. |
.
.
.

Yes the / is for specifying a path much like the \ is used but you need to do this "SDL\\SDL.h" because \\ is the escape sequence for a \.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this