I am having a lot of trouble with linker errors. I don't know what I am doing wrong. I am not even sure what files will help solve this. I have searched for the error codes but it isn't helping me. I haven't been programming long enough to understand it. Please help! I will give you any of my files you might want to see.
1>------ Build started: Project: monsters, Configuration: Debug Win32 ------
1> draw.cpp
1> Generating Code...
1> Skipping... (no relevant changes detected)
1> main.cpp
1>draw.obj : error LNK2019: unresolved external symbol "public: float __thiscall Arm::ArmGetLength(int)" (?ArmGetLength@Arm@@QAEMH@Z) referenced in function "void __cdecl DrawArm(class Arm)" (?DrawArm@@YAXVArm@@@Z)
1>draw.obj : error LNK2019: unresolved external symbol "public: float __thiscall Arm::ArmGetRad(int)" (?ArmGetRad@Arm@@QAEMH@Z) referenced in function "void __cdecl DrawArm(class Arm)" (?DrawArm@@YAXVArm@@@Z)
1>draw.obj : error LNK2019: unresolved external symbol "public: int __thiscall Arm::ArmGetLengthSize(void)" (?ArmGetLengthSize@Arm@@QAEHXZ) referenced in function "void __cdecl DrawArm(class Arm)" (?DrawArm@@YAXVArm@@@Z)
1>draw.obj : error LNK2019: unresolved external symbol "public: __thiscall Arm::Arm(float,float)" (??0Arm@@QAE@MM@Z) referenced in function "void __cdecl `dynamic initializer for 'test''(void)" (??__Etest@@YAXXZ)
1>C:\Users\Cody\documents\visual studio 2010\Projects\monsters\Debug\monsters.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
sorry I haven't really commented anything yet.
This is the draw.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#ifndef DRAW
#define DRAW
#include "draw.h"
#include "Monster.h"
/************************
*functions *
************************/
Arm test(2, 1);
void DrawMonster()
{
/********************
*temp variable *
*move to config file*
********************/
int const MMax = 30;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_QUADS);
//draw each monster.
for (int i = 0; i < MMax; i++)
{
monsterList(i);
}
glEnd();
glFlush();
}
void monsterList(int M) //draws one monster
{
DrawArm(test);
}
void DrawArm(Arm arm)
{
for (int i = 0; i < arm.ArmGetLengthSize(); i++)
{
for (float theta = 0; theta < 360; theta+=22.5)
{
float x = arm.ArmGetRad(i);
float a = x*cos(theta);
glVertex3f(a, sqrt((x*x) - (a*a)), 0);
glVertex3f(a, sqrt((x*x) - (a*a)), -arm.ArmGetLength(i));
a = x*cos(theta + 22.5);
glVertex3f(a, sqrt((x*x) - (a*a)), 0);
glVertex3f(a, sqrt((x*x) - (a*a)), -arm.ArmGetLength(i));
}
}
}
#endif
|
this is draw.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include "Monster.h"
#include <glut.h>
#ifndef MONSTER_DRAW_H
#define MONSTER_DRAW_H
void monsterList(int M);
void DrawMonster();
void DrawArm(Arm arm);
void DrawLeg();
void DrawBody();
void DrawHead();
#endif
|