Sign in to follow this  
Hypherion

problem with SDL

Recommended Posts

Hypherion    140
hi, i can't seem to figure why i get these errors
error: `int SDLGraphics::imageLoad(std::string, int, int, int)' and `SDL_Surface* SDLGraphics::imageLoad(std::string, int, int, int)' cannot be overloaded
error: ISO C++ forbids declaration of `imageLoad' with no type
error: prototype for `int SDLGraphics::imageLoad(std::string, int, int, int)' does not match any in class `SDLGraphics'

for this code SDLGraphics.h
SDL_Surface *imageLoad (string filename, int transparentRed, int transparentBlue, int transparentGreen);


SDLGraphics.cpp
SDLGraphics::imageLoad (string filename, int transparentRed, 
						int transparentBlue, int transparentGreen)
{
	SDL_Surface* loadedimg=NULL;
	SDL_Surface* optimisedimg=NULL;
	
	loadedimg= IMG_Load (filename.c_str() );
	if (loadedimg != NULL)
	{
		optimisedimg= SDL_DisplayFormat (loadedimg);
		
		SDL_FreeSurface (loadedimg);
	}
	
	SDL_SetColorKey (optimisedimg, SDL_SRCCOLORKEY, SDL_MapRGB(optimisedimg->format,transparentRed,	transparentBlue,transparentGreen));	
					
	return optimisedimg;				
}

i'm using eclipse IDE under fedora core 3 (if this info might help though i don't think it's compiler or OS dependant). any help is apreciated :)

Share this post


Link to post
Share on other sites
xstreme2000    152
in your cpp file

SDLGraphics::imageLoad (string filename, int transparentRed, ...

should be

SDL_Surface *SDLGraphics::imageLoad (string filename, int transparentRed,...

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