Jump to content
  • Advertisement
Sign in to follow this  
amateur programmer

error defining a class's method

This topic is 4422 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

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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!