这有什么不对? - ISO C++禁止声明'Circle'没有类型

jex*_*jex 0 c++ iso class

也许你可以帮助我做到这一点.我有一个用于绘制圆的类,但编译器向我发送以下消息:

In file included from ./Includes.h:19,
                 from ./Circle.h:8,
                 from ./Circle.cpp:5:
./GameApp.h:24: error: ISO C++ forbids declaration of 'Circle' with no type
./GameApp.h:24: error: expected ';' before '*' token
Run Code Online (Sandbox Code Playgroud)

这是GameApp.h:

#include "Includes.h"

class GameApp {

public:
 GameApp();
 ~GameApp();
 void Render();

protected:
 void InitGU();
 bool Controls();

 void *dList;  // display List, used by sceGUStart
 void *fbp0;  // frame buffer

 Circle* circle;
};
Run Code Online (Sandbox Code Playgroud)

Include.h看起来像这样:

//************************************************************************
//                              Includes.h
//************************************************************************

#include <malloc.h>     //For memalign()
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdio.h>
#include <psprtc.h>             // for the timer/fps functions
#include <pspctrl.h>
#include <math.h>

// GU
#include <pspgu.h>
#include <pspgum.h>

// Custom
#include "GameApp.h"
#include "Circle.h"


//************************************************************************

// Definitions
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)

#define sin_d(x) (sin((x)*M_PI/180))
#define cos_d(x) (cos((x)*M_PI/180))
#define tan_d(x) (tan((x)*M_PI/180)) 

//************************************************************************

// structs, datatypes...
#ifndef VERTEX_TYPE_
#define VERTEX_TYPE_
typedef struct {
    unsigned int color;
    float x, y, z;
} vertex;
#endif
Run Code Online (Sandbox Code Playgroud)

和Circle.h

//************************************************************************
//                              Circle.h
//************************************************************************

#ifndef CIRCLE_H_
#define CIRCLE_H_

#include "Includes.h"

class Circle {

public:
    Circle(float r1);
    ~Circle();
    void Render();

    float r;
    float x, y;
    float vx, vy;

protected:
    vertex* vertices;
    int n;

};

#endif
Run Code Online (Sandbox Code Playgroud)

str*_*ger 9

千万不能使用一个庞大的,包括对包括-一切(除预编译头).这几乎肯定会导致头痛.

包括你需要的东西,而不是更多.它会解决你的问题.

Circle正如DanDan建议的那样,您可以转发声明,但从长远来看,修复包含问题会对您有所帮助.