我有一个问题,通常我会明白为什么会发生这种情况,我没有在main方法中声明函数。但是这个类本身包含了.h文件,该文件具有此方法的原型,所以我对于它不在主函数范围内的原因有点遗憾。功能没有在主要的范围
using namespace std;
#include "Solar.h"
int main(){
initializeGL();
Stars *Alpha = new Stars(5.0);
Planets *Awe = new Planets(.6,2,30,"Awe",0.0,0.0,0.0);
paintGL();
return 0;
}
void Solar::initializeGL(){
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIV
....
}
还有一个功能paintGL()以后,这里是头文件
class Solar {
public:
void initializeGL();
void resizeGL(int width, int height);
void paintGL();
.....
private:
.....
};
我不是最好使用C++,所以anyhelp将不胜感激。
这里是错误
Solar.cpp:4: error: declaration of âvoid Solar::initializeGL()â outside of class is not definition
Solar.cpp:5: error: declaration of âvoid Solar::paintGL()â outside of class is not definition
Solar.cpp: In function âint main()â:
Solar.cpp:8: error: âinitializeGLâ was not declared in this scope
Solar.cpp:11: error: âpaintGLâ was not declared in this scope
什么是错误信息,它抱怨哪个功能? – 2010-11-18 21:01:45