Error 2337 Trying to Compile OpenGl Code


I am using the Borland C++ 5.5.1 command line compiler to compile OpenGl code with Glut 3.7. However, when I type bcc32 main.cpp I get error 2337, “glut.h 140: only one of a set of overloaded functions can be “C”.” I am doing this on WIN98, ME, and NT 4.0 and get the same error. I have used the implib tool to convert glut32.dll, opengl32.dll, and glu32.dll to .lib files. I have also set the path in my .cfg files to c:\borland\bcc55\Lib and c:\borland\bss55\Include and c:\borland\bcc55\Include\Gl. The code compiles and runs in Visual C++ 5.0. I would appreciate some help in solving this problem. Thanks in advance for the help!

#ifdef FLAT
#include <windows.h>
#include <gl/glut.h>

// The initialisation function
void init(void)
glClearColor(1.0, 1.0, 1.0, 0.0) ;
glShadeModel(GL_FLAT) ;

// The display function
void display(void)

glutSwapBuffers() ;


// The main function
int main(int argc, char** argv)
glutInit(&argc, argv) ;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB) ;
glutInitWindowSize(400, 400) ;
glutInitWindowPosition(100, 100) ;
glutCreateWindow(“Second Chapter - Opening an OpenGL Window”) ;

init() ;

glutDisplayFunc(display) ;

glutMainLoop() ;

return 0 ;


You did not have to create import libraries for the dlls Borland comes with the right .libs. The GLUT problem is with the exit function in C++. If you rename your file to a .c should it compile without problem.

To be able to compile C++ with Borland must the glut header be updated. Here is one try:
and here is another:

Thanks for the help mango!

I discovered that if I commented out the first three lines and compiled the code as a .cpp with the new libs that it worked. I also tried your fix and discovered that it still wanted the new libs, but I didn’t have to comment out the first three lines. I also had to make a new lib from the winmm.dll file for both fixes to work. I am by no means a C/C++ expert so I am not sure what the deal is. Thanks for the info again. It was a great help!