我是一个相当新的程序员,我正在Visual Studio / C ++ / SDL中制作一个小型游戏项目。所以我的代码是这样布置的:
prototypes.h:
#ifndef PROTOTYPES_H
#define PROTOTYPES_H
#include "constants.h"
#include "globals.h"
#include "functions.h"
struct circle
{
float x;
float y;
int r;
};
//other class declarations
#endif PROTOTYPES_H
functions.h:
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
#include "SDL_header.h"
#include "prototypes.h"
bool check_collision(circle circle, SDL_Rect rect);
//other function declarations
#endif FUNCTIONS_H
据我所知至少是根据this的解释是完全正确的。即使将鼠标悬停在IDE中functions.h文件中的“圆”上,我也会弹出正确的工具提示“结构圆”。但是,当我编译时,在引用functions.h ...时出现错误'未声明的标识符'circle'
什么鬼..?
我是一个相当新的程序员,我正在Visual Studio / C ++ / SDL中制作一个小型游戏项目。因此,我的代码如下所示:prototypes.h:#ifndef PROTOTYPES_H #define PROTOTYPES_H #include“ ...
您当前有一个循环包含。 Prototype.h包含functions.h,functions.h包含prototype.h