SDL with VC 8

Started by
8 comments, last by Mybowlcut 16 years, 9 months ago
Hello. I'm trying to install SDL on my computer (XP). I have Visual Studio 8, which doesn't appear to be supported on the SDL site under the development libraries (Win32). Does anyone know if having a later version will affect the installation? Cheers.

Advertisement
Those libraries will for with your version of visual studio. I've gotten them to work on VC++ 6, 7, and 8 express.

Learn to make games with my SDL 2 Tutorials

Quote:Original post by Lazy Foo
Those libraries will for with your version of visual studio. I've gotten them to work on VC++ 6, 7, and 8 express.


Oh, ok. Cheers, I used your tutorial and it worked... one question. Do I have to do that every time I create a new project? Also, I've never had to use
int argc, char* args[]
as arguments for main... If I leave those out now, using the project settings I've made for SDL, it gives me a link error. :O

Also, following your VC express 8 tut, can I debug using
Multi-Threaded DLL
, or do I have to change it to
Multi-Threaded Debug DLL
?

Quote:Original post by Mybowlcut
Quote:Original post by Lazy Foo
Those libraries will for with your version of visual studio. I've gotten them to work on VC++ 6, 7, and 8 express.


Oh, ok. Cheers, I used your tutorial and it worked... one question. Do I have to do that every time I create a new project? Also, I've never had to use
int argc, char* args[]
as arguments for main... If I leave those out now, using the project settings I've made for SDL, it gives me a link error. :O


Yeah you'll have to do that every time you create a project. You can just do what I do and reuse the same project.

SDL requires you declare you main function like that for cross platform compatibility.

Learn to make games with my SDL 2 Tutorials

Quote:Original post by Mybowlcut
Also, following your VC express 8 tut, can I debug using
Multi-Threaded DLL
, or do I have to change it to
Multi-Threaded Debug DLL
?


IIRC, Visual Studio will give you a warning if you use "Multi-Threaded Debug DLL". I don't really use visual studio all that much so I can't really tell you the difference between using either one, I just know "Multi-Threaded DLL" won't give you a warning..

Learn to make games with my SDL 2 Tutorials

Oh, ok. I read the thing about main too. One more thing with your tutorial... I get this error:

Warning 1 warning C4312: 'type cast' : conversion from 'uintptr_t' to 'void *' of greater size c:\everything\programs\microsoft visual studio 2005\vc\include\xlocnum 590

twice... do you know why? I wouldn't have a clue what that means... haha.

Quote:Original post by Mybowlcut
Oh, ok. I read the thing about main too. One more thing with your tutorial... I get this error:

Warning 1 warning C4312: 'type cast' : conversion from 'uintptr_t' to 'void *' of greater size c:\everything\programs\microsoft visual studio 2005\vc\include\xlocnum 590

twice... do you know why? I wouldn't have a clue what that means... haha.


What code gave you that error?

Learn to make games with my SDL 2 Tutorials

#include "SDL/SDL.h"#include <string>using std::string;const int SCREEN_WIDTH = 640;const int SCREEN_HEIGHT = 480;const int SCREEN_BPP = 32;SDL_Surface* message = NULL;SDL_Surface* background = NULL;SDL_Surface* screen = NULL;SDL_Surface* load_image(string filename){	//Temporary storage for the image that's loaded	SDL_Surface* loadedImage = NULL;	//The optimized image that will be used	SDL_Surface* optimizedImage = NULL;	//Load the image	loadedImage = SDL_LoadBMP(filename.c_str());	//If nothing went wrong in loading the image	if(loadedImage != NULL) {		//Create an optimized image		optimizedImage = SDL_DisplayFormat(loadedImage);		//Free the old image		SDL_FreeSurface(loadedImage);	}	//Return the optimized image	return optimizedImage;}void apply_surface(int x, int y, SDL_Surface* src, SDL_Surface* dest){	//Make a temporary rectangle to hold the offsets	SDL_Rect offset;	//Give the offsets to the rectangle 	offset.x = x;	offset.y = y;	//Blit the surface	SDL_BlitSurface(src, NULL, dest, &offset);}int main(int argc, char* args[]){	return 0;}


:)

That error is due to some sloppy programming in the SDL library, not your code. There is a header in SDL that does something along the lines of
#ifdef WIN32//defines uintptr_t as 32 bit address#endif#ifdef WIN64//defines uintptr_t as 64 bit address#endif

Obviously, as the compiler tries to detect any 64-bit compatibility problems in your project, the 32-bit version of uintptr_t is seen as an issue eventhough it isn't.

The only way to get around this that I know of (other than compiling in 64-bit) is to disable 64-bit compatibility warnings. There is an option for it in VC 8, under project settings->C++ I believe. The compiler flag you want is /Wp64.

Of course, that means the compiler will not detect any other 64-bit compatibility problems you may create yourself in the future.
-------------Please rate this post if it was useful.
Quote:Original post by Hnefi
That error is due to some sloppy programming in the SDL library, not your code. There is a header in SDL that does something along the lines of
*** Source Snippet Removed ***
Obviously, as the compiler tries to detect any 64-bit compatibility problems in your project, the 32-bit version of uintptr_t is seen as an issue eventhough it isn't.

The only way to get around this that I know of (other than compiling in 64-bit) is to disable 64-bit compatibility warnings. There is an option for it in VC 8, under project settings->C++ I believe. The compiler flag you want is /Wp64.

Of course, that means the compiler will not detect any other 64-bit compatibility problems you may create yourself in the future.


Oh, I see. I think I'll disable it since I won't be making anything for 64-bit OS's anytime soon. :p

This topic is closed to new replies.

Advertisement