私は昨夜からこれに悩まされてきました、そして私の人生の間、私はこれがなぜ起こっているのか理解することができませんでした。とてもシンプルなものが欠けているに違いありません。
私はOpenGLプログラムを作っています。このプログラムでは、DialogBoxクラスを作成しています。以下はコードです:
//---------------------------------------------------------------
//DialogBox.h
//---------------------------------------------------------------
#include <vector>
class DialogBox
{
private:
float X; float Y; float Z;
float Width;
float Height;
float RED;
float GREEN;
float BLUE;
float ALPHA;
int currentLine;
int maxLines; //How many lines of text this dialog box can hold
int maxChars; //How many chars each line of text can hold
std::vector< std::vector<char> >Text; //Text contents of the Dialog Box
unsigned int vertexArray_DialogBox;
unsigned int vertexBuffer_DialogBox;
public:
DialogBox();
DialogBox(float width, float height);
void draw();
void draw(float x, float y, float z);
};
//------------------------------------------------------------------------
//DialogBox.cpp
//------------------------------------------------------------------------
#include <iostream>
#include "DialogBox.h"
DialogBox::DialogBox()
{
X = 0.0f; Y = 0.0f; Z = 0.0f;
Width = 1.0f;
Height = 1.0f;
RED = 0.0f;
GREEN = 1.0f;
BLUE = 1.0f;
ALPHA = 1.0f;
//For HELVETICA_18 ----------------------
static const float letter_width = 0.03f;
static const float letter_height = 0.04f;
static const float line_height = 0.1f;
//---------------------------------------
maxLines = Height / line_height - 4;
maxChars = Width / letter_width - 2;
Text.resize(maxLines);
for(int i = 0; i < maxLines; i++)
{
Text[i].resize(maxChars);
}
}
DialogBox::DialogBox(float width, float height)
{
Width = width;
Height = height;
//The rest of the initialization codes
}
void DialogBox::draw()
{
//OpenGL Drawing codes
}
void DialogBox::draw(float x, float y, float z)
{
X = x; Y = y; Z = z;
draw();
}
そして、コンパイラはこのエラーメッセージをスローしました:
髪の毛を抜いてきましたが、コンパイラが何を指しているのかわかりませんでした。それは本当に単純なものでなければなりません(コードのタイプミスなど)。よろしくお願いします。