我正在尝试在一个类中设置一个静态指针变量,但是对于我尝试设置的每个变量,我都会收到这些错误。
错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持默认整数
错误 C2040:“xscroll”:“int”的间接级别与“float *”不同
错误 C2440:“正在初始化”:无法从“浮点 **”转换为“整数”
这是代码 Enemy.h
#include <windows.h>
#include "Player.h"
class Enemy
{
public:
Enemy(float xPos, float yPos);
Enemy(void);
~Enemy(void);
//update the position of the user controlled object.
void updatePosition(float timeFactor);
//loads all the enemy textures
void static loadTextures();
//creates a set number of enemies
void static createEnemies(int numEnemies, Enemy * enemyArray);
GLuint static enemyTex;
static float * xscroll;
static float * yscroll;
static Player * player;
private:
bool checkCollison(float x, float y, int radius);
float XPos;
float YPos;
};
试图设置变量
Enemy::xscroll = &xscroll;
Enemy::yscroll = &yscroll;
Enemy::player = &player;