error ?

Started by
9 comments, last by sebnem_a 20 years, 6 months ago
I use the following glut functions in borland c++ in a (form) Why the code gives the following error? [Linker Error] Unresolved external ''glutInitDisplayMode'' referenced from C:\DOCUMENTS AND SETTINGS\ÞEBNEM AKBULUT\DESKTOP\PRJV2.1\PRJV21.OBJ [Linker Error] Unresolved external ''glutCreateWindow'' referenced from C:\DOCUMENTS AND SETTINGS\ÞEBNEM AKBULUT\DESKTOP\PRJV2.1\PRJV21.OBJ [Linker Error] Unresolved external ''glutDisplayFunc'' referenced from C:\DOCUMENTS AND SETTINGS\ÞEBNEM AKBULUT\DESKTOP\PRJV2.1\PRJV21.OBJ The code is; void __fastcall TForm1::Button4Click(TObject *Sender) { MessageDlg("Display Object.", mtInformation, TMsgDlgButtons() << mbOK, 0); GLfloat rtri; GLfloat x_t,y_t,z_t; int n1,n2,n3; glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutCreateWindow("Your 3D Object"); glutDisplayFunc(RenderScene); SetupRC(); glTranslatef(0.0f,0.0f,-6.0f); glRotatef(rtri,1.0f,0.0f,0.0f); // Process each triangle .... Please help me..
Advertisement
Did you include glut and its libraries?? Your linker thinks it should have those functions, but it cant find them. Thats why it is causing you trouble
I ve included the following ;

#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include <gl\glut.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <vcl.h>
#include <conio.h>
#include "prjv21.h"

those are "header" files, not libraries..

you have to have sth like glut.lib or glut32.lib (I really don''t know the name) with lib extension.. you should insert it to your project.. I don''t know how to insert a lib into the project in Borland compiler, probably in preoject settings somewhere..
-----------my quote is under construction
I ve included glut32.lib into borland C++ lib folder..
But still this problem..
Just putting it in the folder is not enough, you need to link the project to the library. The simplest way is

#pragma comment(lib, "glut32.lib")
When I add that it gives the following error message..

[Linker Error] ''C:\PROGRAM FILES\BORLAND\CBUILDER5\LIB\GLUT32.LIB'' contains invalid OMF record, type 0x21 (possibly COFF)
That''s because the #pragma is MSVC++ specific.
negatory there man. the pragma works for cbuilder as well, but the file isnt compatible with cbuilder. search the web for a compatible one, or read in the documents how to convert the lib to cbuilder style...
I did it

from a command prompt:
IMPLIB glut32.lib glut32.dll
This works..
Thanks.

This topic is closed to new replies.

Advertisement