PDA

View Full Version : Unresolved external errors



hi_speed_idiot
03-06-2002, 04:11 PM
The following is a basic polygon program written in C++ with Cbuilder5, and every time i compile or run it, i get the linker errors:

[Linker error] - Unresolved external '_Form1' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\PROJECT1.OBJ
[Linker error] - Unresolved external 'TForm1::' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\PROJECT1.OBJ

If i run the DOS command line module(bcc32) i get these errors instead:

Unresolved external 'glutInit' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ
Unresolved external 'glutInitDisplayMode' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ
Unresolved external 'glutInitWindowSize' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ
Unresolved external 'glutInitWindowPosition' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ
Unresolved external 'glutCreateWindow' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ
Unresolved external 'glutDisplayFunc' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ
Unresolved external 'glutMainLoop' referenced from C:\BORLAND\CBUILDER5\MYSOURCE\GLUT2.OBJ

********** ********** **********

FOLLOWING is the source code of the program:

#include <windows.h>
#include <gl/glut.h>
#include <stdlib.h>

void init(void);
void display(void);


int main(int argc, char** argv) {

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return(0);
}

void init(void) {

glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

void display(void) {

glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
}

********** ********** **********

I have already made sure i had all the necessary header, library and DLL files stored in the correct places(though perhaps i do not have a compatible set of them given that some have different creation dates[all 32bit format still]).

If you can tell me where to get a complete and updated set of the OpenGL(the 3 LIB, H & DLL) files, or if you can help me overcome this problem, as i am unsure if it is a C++ error or a Borland error, i would greatly appreciate it as i seem to be stumped with it, Thank you.

JML
03-06-2002, 11:13 PM
Make sure the GLUT LIB is included in the link step (or make the directory it is stored in one of the default directories included in your link step).

HTH

Jean-Marc

hi_speed_idiot
03-07-2002, 03:08 AM
It is already referenced in the linker config file, under the default directory /LIB, ofcourse the lib files are there. One extra bit of info though that may help clarify it, is that with this program code, still uisng the OpenGL files, it runs through without any errors:

FOLLOWING is the program code that does work:

#include <iostream.h>
#include <windows.h>
#include <gl/gl.h>

main() {

glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 0.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();

}

Got any ideas what my problem is???