Skip to main content
GameDev.net gamedev.net
🔒 Locked

Error in the glut.h

Started by Ligreman Dec 17, 2002 at 5:45 AM 3 replies 5.2k views
Original Post
Ligreman
Ligreman
I''ve this problem. Whenever I include the glut.h library, I get error in this line (of the glut.h): extern _CRTIMP void __cdecl exit(int); //line 146 I''ve downloaded many times the library, and I''ve installed the .dll and .lib correctly. But always have the same error. For example, using the tutorials of Nehe''s page about Glut. So, what I''m doing wrong?
Zorak
Zorak
whats the error message?
Domine non secundum peccata nostra facias nobis
Ligreman
Ligreman
Uhh sorry, I forgot

This is the message:

[C++ Error] glut.h(146): E2337 Only one of a set of overloaded functions can be "C"

I''m new with C++ so I don''t get it all.
Zorak
Zorak
Are you including the file twice?

Do you have a function named exit in your program?

Have you included or ?

Domine non secundum peccata nostra facias nobis
Fruny
Fruny
glut.h is correct.

You're using Visual C++ 7.0, which changed the prototypes for exit and abort (addedd a __declspec(noreturn) - a Microsoft extension, not standard C++.

Go read the 'correct' declaration in and mirror it into glut.h with an #ifdef testing that you have the 'right' version of Visual C++.

Edit: Ah, well, here's the code to be substituted in glut.h

#if defined(_WIN32)
# ifndef GLUT_BUILDING_LIB
# if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl abort(void);
_CRTIMP __declspec(noreturn) void __cdecl exit(int);
# else
_CRTIMP void __cdecl abort(void);
_CRTIMP void __cdecl exit(int);
# endif
# endif
#else
/* non-Win32 case. */




[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]


[edited by - Fruny on December 17, 2002 8:09:51 AM]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.