GLUT and CodeWarrior please help

Hello everyone,

I am having considerable troulbe just getting GLUT to work.

I’ve put the glut32.dll in C:\WINDOWS\system32\

Then the glut.h to C:\Program Files\Metrowerks\CodeWarrior\Win32-x86
Support\Headers\Win32 SDK\GL\

adn then the glut32.lib to C:\Program Files\Metrowerks\CodeWarrior\Win32-x86
Support\Libraries\Win32 SDK\

Then when I create a C++ console application, I add the libaries: glu32.lib, glut32.lib and opengl32.lib

In my main CPP file I have included the header files in this way:

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

And then an almost empty main.

When I try to compile I get the following errors:

Error : ambiguous access to overloaded function
‘std::exit(int)’
‘exit(int)’
glut.h line 486 nit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }

Error : ambiguous access to overloaded function
‘std::exit(int)’
‘exit(int)’
glut.h line 503 _ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }

Error : ambiguous access to overloaded function
‘std::exit(int)’
‘exit(int)’
glut.h line 549 CK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }

Am I missing something? some setting in Code warror?

Please help.

Thank you,

Pancho

  1. At the top of your source file type:

#define GLUT_DISABLE_ATEXIT_HACK

  1. Remove all the Opengl headers from the GL folder. Place these files “glut.h, gl.h, etc…” among
    all the other Win32 SDK header files.

  2. Compile source.

  3. When you get error messages kicked back, and you will! Go to that error and open the header file in the error message, change GL/gl.h and so on to just gl.h, glu.h etc… they are near the top of the header file you opened. You will get a warning that says something like “blah, blah Read Only” - change that. Remove any reference of “GL/” - NOT the name of header file specifically like gl.h, glu.h- just “GL/”

So it looks like this in the header your editing AND you source code.
#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>
#include “gl.h”
#include “glu.h”
#include “glut.h”

You don’t need that wingdi.h

More specific:

At top of source code:

#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>
#include “gl.h”
#include “glu.h”
#include “glut.h”

You don’t need that wingdi.h

And in GL specific headers:
#include <gl.h>