PDA

View Full Version : GLUT and Builder5



12-10-2000, 06:42 AM
Hello, If I want to compile this code in bilder5 I get this error message:
[C++ Error] GLUT.H(140): E2337 Only one of a set of overloaded functions can be "C", and in glut.h it mark this row(row 140): extern _CRTIMP void __cdecl exit(int);
Here is the code:
#ifdef __FLAT__
#include <windows.h>
#endif
#include <stdio.h>
#include <gl\gl.h>
#include <gl\glut.h>
int main(int argc, char* argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB );
glutInitWindowSize(500,400);
glutInitWindowPosition(0,0);
glutCreateWindow("Az elso OpenGL programom");
glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0,0.0,1.0);
glOrtho(-4.0,4.0,-2.0,2.0,-2.0,2.0);
glBegin(GL_POLYGON);
glVertex2i(-1,1);
glVertex2i(1,1);
glVertex2i(1,-1);
glEnd();
glFlush();

getchar();

return 0;
}

Anyone can help me?

12-10-2000, 07:00 AM
The atexit hack does not work in C++ for the Borland compiler.

One to disable it is to put
#define GLUT_DISABLE_ATEXIT_HACK
before you include glut.h

12-10-2000, 07:54 AM
I tried it, howevever it doesn't work, but I tried something similar: I put #define GLUT_BUILDING_LIB before the #include <gl/glut.h> and it works!! Yuppie! So thank you.