I have a problem, normally I would understand why this is happening, I didnt declare the function in the main method. But the class itself includes the .h file, which has the prototype for this method, so I am a bit lost on why it is not in the scope of the main function.
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
....
}
There is also a function paintGL() later on, and here is the header file
class Solar {
public:
void initializeGL();
void resizeGL(int width, int height);
void paintGL();
.....
private:
.....
};
I am not the best with c++, so anyhelp will be appreciated.
ANd here is the error
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
Solaris a class, andinitializeGLandpaintGLare member functions. If you wanted to use them, you would have to create an instance ofSolar.Read up on member functions: http://msdn.microsoft.com/en-us/library/fk812w4w.aspx