PDA

View Full Version : Borland glut.h error: One set of overloaded "c" functions



delic
10-21-2002, 06:55 AM
Error E2337 d:\Borland\Bcc55\include\gl/glut.h 146: Only one of a set of overloaded functions can be "C"

I can not fix this error!! Anyone know the fix?? It has to do with the exit() function and the link types (cdecl, stdcall,etc.).

Gorg
10-21-2002, 07:41 AM
I dont' remember if it was the same error message, but just look at the link below and search "Eric change" to see what I modified to get it to compile. It will probably fix yours too.
http://members.rogers.com/deseric/glut.h

The problem was that Borland's STL exit function is not a C function but a C++ function. And it also has a few overloads. So that freaks out the extern "C". I believe that my comments in the glut.h are not very correct.


[This message has been edited by Gorg (edited 10-21-2002).]

delic
10-21-2002, 08:22 AM
gorg,

I absolutely love you.. Your fix worked like a charm!!! Thanks, I really appreciate the help

by the way for anyone with same problem this is the fix:

1) Add the following lines :

#ifdef __BORLANDC__ //ERIC CHANGE
#include <stdlib.h> //bring exit into global scope
#endif //ERIC CHANGE

Just above the lines:
#endif /* _WIN32 */

#include <GL/gl.h>
#include <GL/glu.h>
Around line 133 in glut.h(atleast in the one I have)
2) Then change line 146 in glut.h or the line that declares the extern _CRTIMP void __cdecl exit(int);
with the following:

#ifndef __BORLANDC__ //ERIC CHANGE
//in borland this function is not extern C.
//stdlib.h is included somewhere above
extern _CRTIMP void __cdecl exit(int);
#endif //__BORLAND_C //ERIC CHANGE