Jump to content
  • Advertisement
Sign in to follow this  

problem with SDL

This topic is 4482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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::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
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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!