3
I次のヘッダーファイルを持っている:glColor()
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "classes.h" // objects within the game
#include <iostream>
使用:以下の介在物を有する.CPPメインファイルに含まれている
#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
上記のすべてのヘッダをヘッダファイルにインクルードしても、ヘッダファイル内のglColor()の「このスコープで宣言されていません」というエラーが表示されます。私は以前これを経験したことがなく、なぜ私がエラーを受けているのか分からない。
ありがとうございました!
これは私の問題を解決します。私はglColor()をWindowsのようにコンパイルするときにこのように使うことができました。 –