我有点新手,不太会C++。我在设置头文件时遇到了麻烦。以下是 functions.h 的内容。
extern void apply_surface(int, int, SDL_Surface *, SDL_Surface *,SDL_Rect *);
这是来自functions.cpp文件的函数定义。
void
apply_surface(int x, int y, SDL_Surface * source, SDL_Surface *
destination,SDL_Rect *clip = NULL)
{
...
}
这是我在 main.cpp 中使用它的方式。
#include "functions.h"
int
main (int argc, char * argv[])
{
apply_surface(bla,bla,bla,bla); // 4 arguments, since last one is optional.
}
但是这个代码不能编译,因为 main.cpp 不知道最后一个参数是可选的。我该如何让它工作?