Compiling in DevC

Im new to programming open gl and ive just started using glut

When i include glut.h the compiler tells me it cant find it, does anybody know how to use this in DevC++

Pls bear with me i am new to open gl and the dev compiler

regards mitch

I had the same problem when I installed it.

Dev-c does have the glut library file ‘libglut32.a’ but did not have the glut.h file in the include/GL/ directory or the include directory. Note the library files look a little diffrent then maybe you are used to say with MSVC or Borland.

You can go to Nate Robins website and download the glut for windows files. http://www.xmission.com/~nate/opengl.html

After downloading the files, extract them and move the glut.h file to the include/GL directory.

Also need to include the openGL librarys to the linker settings.
Look at project options and linker options and add the following:
-lopengl32 -lglu32 -lglut32

Originally posted by Kinasz:
[b]Im new to programming open gl and ive just started using glut

When i include glut.h the compiler tells me it cant find it, does anybody know how to use this in DevC++

Pls bear with me i am new to open gl and the dev compiler

regards mitch[/b]

I had the same problem and downloading glut.h helped a bit ofcourse.

But now when I include glut.h in a file I get the following 3 errors:
undefined reference to ‘__glutInitWithExit@12’
undefined reference to ‘__glutCreateWindowWithExit@8’
undefined reference to ‘__glutCreateMenuWithExit@8’

Anyone have any idea what could be wrong? it’s got me pretty stuck :frowning:

What release of Dev-C++ do you have on release 4.

Did you add the library files to link, under project options. Look at linker options, should have the following:

-lopengl32 -lglu32 -lglut32

If that is not the problem do you have #include<windows.h>, at least on release 4 did not seem to care if I had it or not, can not say for release 5.
But some compilers versions ether need it or complain when you use it. Can try it with it commented out or if not there add it.

Originally posted by Soren P.:
[b]I had the same problem and downloading glut.h helped a bit ofcourse.

But now when I include glut.h in a file I get the following 3 errors:
undefined reference to ‘__glutInitWithExit@12’
undefined reference to ‘__glutCreateWindowWithExit@8’
undefined reference to ‘__glutCreateMenuWithExit@8’

Anyone have any idea what could be wrong? it’s got me pretty stuck [/b]

I’m using Dev-C++ v. 4.01 on WinXP

the linkers are in place and I’ve tried both with and without windows.h and no luck.

I have seen someone else with that same error, but thought it was the windows.h that fixed it. Make sure you have the correct glut32.lib for Dev-C++ and not VC++.

If nothing else, drop me an e-mail and I will send my libglut32.a and glut.h files to see if that helps.

Originally posted by Soren P.:
[b]I’m using Dev-C++ v. 4.01 on WinXP

the linkers are in place and I’ve tried both with and without windows.h and no luck.

[/b]

[This message has been edited by nexusone (edited 01-21-2003).]

It works now, but for anyone else having same problem:

Someone on the dev-C++ board found a workaround to the problem, you need to enter the following:

#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

it’s an odd way to do it, but it worked for me without any problems.