Sunday, August 2, 2009

C++ error =(?

I'm programming a simple openGL program, but the compiler(Dev-C++) won't compile it, the code is: #include %26lt;gl/gl.h%26gt;


#include %26lt;gl/glu.h%26gt;


#include %26lt;glut.h%26gt; void RenderScene(void){


glClear(GL_COLOR_BUFFER_BIT);





glFlush();


}





void SetupRC(void){


glClearColor(0.0f,0.0f,1.0f,1.0f);}


void main(void){


glutInitDisplayMode(GLUT_SINGLE|GLUT_R...


glutCreateWindow("SIMPLE");


glutDisplayFunc(RenderScene);


SetupRC();


glutMainLoop();


} and the error message i keep getting is 'main' must return 'int', any suggestions?

C++ error =(?
Main must return int, meaning it must return a value whether it succeded or not. Instead of using void main(), you must use int main() and return 0 in case of succes or whatever you like...
Reply:I think you have to try removing the "void" between the main's brackets





or u can simply change your "void main" to --%26gt; "main" , and insert a "return 0;" statement before you go out the scope of the main (after u call "glutMaunLoop();" )


No comments:

Post a Comment