Ich habe die folgende Header-Datei:
#ifndef CLASSES_H
#define CLASSES_H
class Mouse // Handles clicking of the mouse
{
private:
public:
Mouse()
{
// Constructor
}
void handle_input(int x, int y) // Takes arguments of xloc and yloc of the mouse pointer
{
}
};
class Game_Grid
{
private:
public:
};
class Red_Jewel // Is a circle shape
{
private:
int offset;
public:
Red_Jewel(int offset)
{
this -> offset = offset;
}
void draw()
{
glColor(256,0,0); // Red
}
};
class Green_Jewel // Is a triangle shape
{
private:
int offset;
public:
Green_Jewel(int offset)
{
this -> offset = offset;
}
void draw()
{
glColor(0,256,0); // Green
}
};
class Blue_Jewel // Is a square shape
{
private:
int offset;
public:
Blue_Jewel(int offset)
{
this -> offset = offset;
}
void draw()
{
glColor(0,0,256); // Blue
}
};
// Define objects here; circle jewel, triangle jewel, square jewel, the game grid
#endif // CLASSES_H
die in einer .cpp-Hauptdatei mit den folgenden Einschlüssen enthalten ist:
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "classes.h" // objects within the game
#include <iostream>
Die Verwendung von glColor() in der Header-Datei gibt mir "wurde nicht in diesem Bereich deklariert" Fehler, auch wenn ich alle der oben genannten Header in der Header-Datei enthalten. Ich habe dies noch nie erlebt und weiß nicht, warum ich die Fehler bekomme.
Vielen Dank für jede Hilfe!