ah man i hate linking errors. can someone lend me a hand

ok the code is a textbook implementation of a canvas class. the code is airtight and encapsulated in one cpp file. my external dependencies are glut32 and some file i don’t know why its there. i think it must have been called by the windows.h file. anyhow i have 3 opengl library files in the workspace. there has to be an easy stupid answer for this. if someone can give me a break i’d really apreciate it.
thanks a million.

Michael

--------------------Configuration: canvasmain - Win32 Debug--------------------
Linking…
canvasmain.obj : error LNK2001: unresolved external symbol “public: void __thiscall Canvas::setViewport(int,int,int,int)” (?setViewport@Canvas@@QAEXHHHH@Z)
canvasmain.obj : error LNK2001: unresolved external symbol “public: void __thiscall Canvas::clearScreen(void)” (?clearScreen@Canvas@@QAEXXZ)
canvasmain.obj : error LNK2001: unresolved external symbol “public: void __thiscall Canvas::setColor(float,float,float)” (?setColor@Canvas@@QAEXMMM@Z)
canvasmain.obj : error LNK2001: unresolved external symbol “public: void __thiscall Canvas::setBackgroundColor(float,float,float)” (?setBackgroundColor@Canvas@@QAEXMMM@Z)
Debug/canvasmain.exe : fatal error LNK1120: 4 unresolved externals

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

/supporting classes/

//declaration and implementation???

class Point2
{
public:
Point2() {x=y=0.0f;}
Point2(float xx, float yy) {x=xx;y=yy;}
void set(float xx, float yy) {x=xx;y=yy;}
float getX() {return x;}
float getY() {return y;}
void draw(void) {glBegin(GL_POINTS);
glVertex2f((GLfloat)x, (GLfloat)y);
glEnd();}

float x,y;

};

class IntRect
{
public:
IntRect() {l=0;r=100;b=0;t=100;}
IntRect(int left, int right, int bottom, int top)
{l=left; r=right; b=bottom; t=top;}
void set(int left, int right, int bottom, int top)
{l=left; r=right; b=bottom; t=top;}
void draw(void)
{glRecti((GLfloat)l,(GLfloat)b,(GLfloat)r,(GLfloat)t);}

private:
int l,r,b,t;
};

class RealRect
{
public:
RealRect() {l=0;r=100;b=0;t=100;}
RealRect(float left, float right, float bottom, float top)
{l=left; r=right; b=bottom; t=top;}
void set(float left, float right, float bottom, float top)
{l=left; r=right; b=bottom; t=top;}
void draw(void)
{glRecti((GLfloat)l,(GLfloat)b,(GLfloat)r,(GLfloat)t);}
private:
float l,r,b,t;
};

/* canvas class declaration file */

class Canvas
{
public:
Canvas(int width, int height, char* windowTitle); //constructor
void setWindow(float l, float r, float b, float t);
void setViewport(int l, int r, int b, int t);
IntRect getViewport(void); // divulge viewport data
RealRect getWindow(void);
float getWindowAspectRatio(void);
void clearScreen();
void setBackgroundColor(float r, float g, float b);
void setColor(float r, float g, float b);
void lineTo(float x, float y);
void lineTo(Point2 p);
void moveTo(float x, float y);
void moveTo(Point2 p);

private:
Point2 CP;
IntRect viewport;
RealRect window;
};

/* canvas class implementation file */

//>>>>>>>>>>>>>constructor<<<<<<<<<<<<<<<

Canvas::Canvas(int width, int height, char* windowTitle)
{
char* argv[1]; //dummy argument list for glutInit()
char dummyString[8];
argv[0]=dummyString; // hook-up for pointer
int argc=1; // to satisfy glutInit()

glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(width,height);
glutInitWindowPosition(20,20);
glutCreateWindow(windowTitle);
setWindow(0,(float)width,0,(float)height);
setViewport(0,width,0,height);
CP.set(0.0f,0.0f);

}

//>>>>>>>>>>>>>>moveTo<<<<<<<<<<<<<<<<<

void Canvas::moveTo(float x,float y)
{
CP.set(x,y);
}

//>>>>>>>>>>>>>lineTo<<<<<<<<<<<<<<<<<<

void Canvas::lineTo(float x,float y)
{
glBegin (GL_LINES);
glVertex2f ((GLfloat)CP.x, (GLfloat)CP.y);
glVertex2f ((GLfloat)x, (GLfloat)y);
glEnd();
CP.set (x,y);
glFlush();
}

//>>>>>>>>>>>>>>setWindow<<<<<<<<<<<<<<<<

void Canvas::setWindow (float l, float r, float b, float t)
{
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluOrtho2D ((GLdouble)l, (GLdouble)r, (GLdouble)b, (GLdouble)t);
window.set (l,r,b,t); //real rectangle class
}

//------------------------------------------------------------------

Canvas cvs(640,480, “canvasfun”);

//<<<<<<<<<<<<<display<<<<<<<<<<<<<<<

void display(void)
{
cvs.clearScreen();
cvs.setWindow(-10.0,10.0,-10.0,10.0);
cvs.setViewport(10,460,10,460);
cvs.moveTo(0,-10.0);
cvs.lineTo(0,10.0);
RealRect box(-2.0,2.0,-1.0,1.0);
box.draw();
}

//>>>>>>>>>>>>>>>>>>main>>>>>>>>>>>>>>>
void main(void)
{
cvs.setBackgroundColor(1.0,1.0,1.0);
cvs.setColor(0.0,0.0,0.0);
glutDisplayFunc(display);
glutMainLoop();
}

[This message has been edited by wildeyedboyfromfreecloud (edited 10-25-2001).]

Those member functions have no definitions. So obviously, you need to define them.

oh damn how did i manage to do that. i’m so used to frustrating linking errors i jumped to conclusions. and i guess i kinda thought if the declarations weren’t defined then they would report a compiler error. ok thanks so much.

Originally posted by DFrey:
Those member functions have no definitions. So obviously, you need to define them.

thanks, everything is running smoothly now.