PDA

View Full Version : Compiling in DevC



01-19-2003, 12:10 AM
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

nexusone
01-19-2003, 04:08 AM
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:
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

01-20-2003, 01:53 AM
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 :(

nexusone
01-20-2003, 05:08 AM
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.:
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 http://www.opengl.org/discussion_boards/ubb/frown.gif

01-20-2003, 05:26 AM
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.

nexusone
01-21-2003, 05:33 AM
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.:
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.





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

01-23-2003, 04:01 AM
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.