GLUT compiling error on Borland c++ 5.02

I have tried to configure Borland c++ 5.02 for GLUT/OpenGL. I use Windows 2000 pro OS. As I try to compile I get the warning message
“GLUT.H (486,22): Cannot create pre-compiled header: code in header” and the error message “test.cpp (245,19): Call to undefined function ‘glBindTexture’”. Are these messages related, and do anyone have any idea on how to solve the problem?

dont use borland

go here and download the binaries.

upon opening the zip you will see a file called “README-win32.txt”. If you read that file (which is why it was written), there is a little section that already answers your question…

[ README usually means just that… ]



From what I understand, Borland supplies a utility that
converts Microsoft Visual C++ .libs into Borland compatible
files.  Therefore, the best method for Borland users is
probably to get the precompiled versions of the library and
convert the library.  To create an import library for Borland 
from the DLLs, use the following command (from a command prompt):
      IMPLIB glut32.lib glut32.dll
If IMPLIB crashes when called this way, try
      IMPLIB glut32.lib glut.def
using the glut.def file in this distribution.


Now assuming your version of borland is set up, all you need to do is what it says, ie type the line (!!IN THE DIRECTORY WHERE YOU EXTRACTED THE GLUT BINARIES!!):

IMPLIB glut32.lib glut32.dll


IMPLIB glut32.lib glut.def

that will produce glut32.lib. viola.

Put glut.h in borlands /include/GL/ folder, put glut32.lib in borlands /lib/ folder, and put glut32.dll in your windows/system32/ folder.

compile your glut progs with

bcc32 -eMyProgramName.exe main.c

If you get loads of errors about WINAPI being undefined then add the following flag to the command line :


The openGL and glut libraries should automatically link because of the following lines in glut.h :

#pragma comment (lib, “opengl32.lib”)
#pragma comment (lib, “glu32.lib”)
#pragma comment (lib, “glut32.lib”)

Some compilers may not support that, I believe borland does, however if you get lots of Unresolved external errors then you will probably have to add the names of the 3 GL libs to the end of your command line.

you may get some wierd glutAtExit hack errors when you compile. If you do add the following to your command line options :


You might also want to download a newer version of the Borland compiler 5.55, if you run a search you should be able to find the pre-compiled versions of DirectX8 for Borland. You can then have joypads, sounds etc…

The following link may help