I'm new to C++ graphics, and a friend tipped me off to OpenGL. I'm currently trying to work with the GL Utility Toolkit ( #include gl\glut.h ), which I had to download from the web. Due to all the download sites being intended for people with older versions of Windows (I think), I had to install the *.h, *.o, and *.dll files by hand, but going with the locations specified by the readme that came with the download (from http://www.xmission.com/~nate/glut.html).
However, whenever I try to work with glut.h, I get a cartload of linker errors that yell at me about an undefined reference for any number of functions. Sample: " [Linker error] undefined reference to `__glutInitWithExit@12' ". I am using Bloodshed Dev-C++ version 4.9.9.2.
Please help!!!

I just downloaded the source and compiled with VC++ 2005 Express with no problems using the project that was supplied with the source code. Is it the GLUT source code that you compiled or some file that you wrote?

>>I had to install the *.h, *.o, and *.dll files by hand, but going with the locations specified by the readme that came with the dow
What readme file ? There are several of them. You can put the .DLL anyplace you want as long it is in one of the directories in the PATH statement. The *.h and *.lib files can be anywhere you want, you just have to tell your compiler where to put them if not in one of the standard include directories.

Sorry, Ancient Dragon. Its the readme-win32 file in the "glut-3.7.6-bin.zip" link. Do you have any idea what causes that type of linker error? Thanks!

Those errors mean you did not add the glut32.lib to your project. If you have added it but still get the errors post your program and I'll give it a try.

I'm not as good with software as I'd like to think I am. Where does the glut32.lib file go? I can't find any .lib files to go by on my hard drive except for in my JAVA stuff.

That library was build with VC++ 6.0 compiler. The *.lib file is apparently not compatible with Dev-C++ because it wants a *nix-like filename, such as libglib32.a I created a simple c++ project and just added glib.h then compiled. Got the same errors you reported. I tried to add glut32.lib but dev-c++ apparently didn't do anything with it because it doesn't recognize it as a library.

That means you will either have to use VC++ 2005 (Express), VC++ 6.0 (yuuk), or compile the DLL with dev-c++ compiler.

OK, I appreciate the help! I'll get right on that!


...how do you compile the DLL??? (I know, I don't know a whole lot)

you have to download the source code from that link you originally posted. It includes a project file that I think can be imported by the dev-c++ compiler. If not then you have to create a dll project and add all the source files to it.

By project file do you mean a *.dev? I can't find one. And how do you create a dll project?

>>By project file do you mean a *.dev?
No. VC++ 6.0 uses *.dsw for project filenames.
[edit]I just tried to import it and Dev-C++ failed. Probably because it wants a *.dsp and all we get in the glut distribution is *.dsw.

>> And how do you create a dll project?
In Dev-C++ ? Just select File --> New --> Project, then click the DLL project type icon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.