Sign in to follow this  
amateur programmer

error defining a class's method

Recommended Posts

void apply_surface( int x, int y,SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL ); void Sprite::apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL ) { method body } whats wrong with that? Errors Compiling file: sprite.cc ... g++ -Wall -g -c "sprite.cc" -o "sprite.o" sprite.cc:21: error: default argument given for parameter 5 of ‘void Sprite::apply_surface(int, int, SDL_Surface*, SDL_Surface*, SDL_Rect*)’ sprite.cc:16: error: after previous specification in ‘void Sprite::apply_surface(int, int, SDL_Surface*, SDL_Surface*, SDL_Rect*)’ Completed ... unsuccessful Total time taken: 0 secs

Share this post


Link to post
Share on other sites
You only specify default values in the definition of the function, not the declaration. That is, the first line of code (function definition) should not have the " = NULL" part after clip.

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