自從昨晚我一直堅持使用它,對於我的生活,我一直無法弄清楚爲什麼會發生這種情況。我必須錯過一些非常簡單的事情。C++ - 錯誤C4430:缺少類型說明符(對於構造函數???)
我正在製作一個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();
}
,編譯器拋出此錯誤消息:
我一直在拉我的頭髮,但我無法弄清楚什麼是編譯器參考。它必須是非常簡單的東西(比如代碼中的錯字或類似的東西)。預先感謝您的幫助。
嘗試將您的類重命名爲比DialogBox更不可能的名稱。微軟已經提供了這個名字。作爲替代方案,請參閱是否包含或任何系統標題幫助。 –
賓果!你能否將此作爲答覆發佈,以便我可以接受它?非常感謝你! – TATN