PDA

View Full Version : Help with A simple OpenGL and glut program



babar
04-21-2009, 11:51 AM
Hi,
I am new to OpenGL. I am trying to run an example 'glut_helloWolrd' program in VS2005. But I am finding a lot of errors, 143 :p !. I found a solution for s bit liking problem to include OpenGL32.lib, I search the net but don't find one.
I will be very thankful if some one looks into my problem & also kindly tell me the source from where, I can get lib file.

#include <GL/gl.h>
#include <GL/glut.h>

void display() {
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitWindowSize(512,512);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("The glut hello world program");
glutDisplayFunc(display);
glClearColor(0.0, 0.0, 0.0, 1.0);
glutMainLoop(); // Infinite event loop
return 0;
}

errors(a few of those)

Compiling...
glut_helloWorld.cpp
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1152) : error C2144: syntax error : 'void' should be preceded by ';'
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1152) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1152) : error C2146: syntax error : missing ';' before identifier 'glAccum'
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1152) : error C2182: 'APIENTRY' : illegal use of type 'void'
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1152) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1153) : error C2144: syntax error : 'void' should be preceded by ';'
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1153) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1172) : error C2182: 'APIENTRY' : illegal use of type 'void'
.
.
.
d:\programs\microsoft visual studio 8\vc\platformsdk\include\gl\gl.h(1172) : fatal error C1003: error count exceeds 100; stopping compilation
Build log was saved at "file://c:\Documents and Settings\admin\Desktop\Augmented Reality\OpenGL_C++\VS_glut_source\glut_C++\glut_C+ +\Debug\BuildLog.htm"
glut_C++ - 143 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

thanks a lot in advance.....

babar
04-21-2009, 12:21 PM
OK,
thanks to all people.
I found from some source solution to add
#include <windows.h>.
its working mow !
I will need your help in coming days....