I am kind of new to C++. I am having trouble setting up my headers. This is from functions.h
extern void apply_surface(int, int, SDL_Surface *, SDL_Surface *
The default parameter value should be in the function declaration (functions.h), rather than in the function definition (function.cpp).
You make the declaration (i.e. in the header file - functions.h
) contain the optional parameter, not the definition (functions.cpp
).
//functions.h
extern void apply_surface(int, int, SDL_Surface *, SDL_Surface *,SDL_Rect * clip = NULL);
//functions.cpp
void apply_surface(int x, int y, SDL_Surface * source, SDL_Surface *
destination,SDL_Rect *clip /*= NULL*/)
{
...
}
Use:
extern void apply_surface(int, int, SDL_Surface *, SDL_Surface *,SDL_Rect * = NULL);
(note I can't check it here; don't have a compiler nearby).