Error LNK2019 (cant find the missing Link)

Hello and thank you for your time.

I am currently very new to programming and attempting to work through the book
"Muli-threaded Game Engine Design
I am currently attempting to do the Matrix test code, however keep encountering the following error

"Error 1 error LNK2019: unresolved external symbol "public: __thiscall Octane::Matrix::Matrix(struct D3DXMATRIX const &)" (??0Matrix@Octane@@QAE@ABUD3DXMATRIX@@@Z) referenced in function "void __cdecl game_render2d(void)" (?game_render2d@@YAXXZ) H:\Deans Programming\Engine Chapters\InitEngineTest\InitEngineTest\Math Matrix Demo.obj"

I found a previous error that was similar which was based on a simple spelling mistake however I can not figure this out at all.

Based upon the error, i'am guessing it has something to do with the Matrix.h which contains the struct D3DXMATRIX and the main cpp named "math matrix demo" which contains the void game_render2d

Math Matrix Demo.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  #include "Engine.h"
#include "Matrix.h"
#include "Vector.h"
using namespace std;
using namespace Octane;

Font *font=NULL;

bool game_preload()
{
	g_engine->setAppTitle("Math Matrix Demo");
	g_engine->setScreen(1024,768,32,false);
	return true;
}

bool game_init(HWND hwnd)
{
	font = new Font( "Arial Bold", 18);
	if (!font)
	{
		debug << "Error creating font" << endl;
		return false;
	}
	return true;
}

void game_end()
{
	if (font) delete font;
}

void game_update( float elapsedTime ) {}
void game_render3d() {}

std::string Vector2ToString( Vector2& V )
{
	ostringstream out;
	out << V.getX() << ", " << V.getY();
	return out.str();
}

std::string Vector3ToString( Vector3& V )
{
	ostringstream out;
	out << V.getX() << ", " << V.getY() << ", " << V.getZ();
	return out.str();
}

std::string MatrixToString( D3DXMATRIX& M )
{
	ostringstream out;
	out << M._11 << ", " << M._12 << ", " << M._13 << ", " << M._14 << endl;
	out << M._21 << ", " << M._22 << ", " << M._23 << ", " << M._24 << endl;
	out << M._31 << ", " << M._32 << ", " << M._33 << ", " << M._34 << endl;
	out << M._41 << ", " << M._42 << ", " << M._43 << ", " << M._44;
	return out.str();
}

void game_render2d()
{
	std::ostringstream out;
	out.setf(ios::fixed);
	out << setprecision(2);

	Matrix A;
	A.setIdentity();
	A *= 1.25f;
	out << "Matrix A * 1.25 = " << endl << MatrixToString(A) << endl << endl;

	Matrix B;
	B.Fill( 12.875 );
	out << "Matrix B = " << endl << MatrixToString(B) << endl << endl;

	A += B;
	out << "Matrix A + B = " << endl << MatrixToString(A) << endl << endl;

	Matrix C = B * 2.75;
	out << "Matrix C = B * 2.75 : " << endl << MatrixToString(C) << endl << endl;

	D3DXMATRIX D;
	D3DXMatrixRotationX( &D, 3.14f );

	//instantiating a Matrix on the heap
	Matrix *E = new Matrix( D );
	out << "Matrix E = D (D3DXMATRIX copy) : " << endl << MatrixToString( *E ) << endl << endl;

	E->setIdentity();
	E->Translate( 1, -2, 3 );
	out << "E -> Translated (1, -2, 3) = " << endl << MatrixToString( *E ) << endl << endl;

	font->Print(0, 0, out.str());

	//Start second column
	out.str( "" );
	E->Scale( 1, -2, 3 );

	E->rotateX( 1 );
	out << "E -> RotateX(1) = " << endl << MatrixToString( *E ) << endl << endl;

	E->rotateY( -2 );
	out << "E -> RotateY(-2) = " << endl << MatrixToString( *E ) << endl << endl;

	E->rotateZ( 3 );
	out << "E -> RotateZ(3) = " << endl << MatrixToString( *E ) << endl << endl;

	E->rotateYawPitchRoll( 1, -2, 3 );
	out << "E-> RotateYawPitchRoll(1, -2, 3) = " << endl << MatrixToString( *E ) << endl << endl;

	delete E;

	font ->Print(400, 0 , out.str() );
}

void game_event( IEvent* e )
{
	switch( e->getID() )
	{
	case EVENT_KEYPRESS:
		{
			KeyPressEvent* evt = (KeyPressEvent*) e;
			if (evt->keycode == DIK_ESCAPE)
				g_engine->Shutdown();
			break;
		}
	}
}


Matrix.h
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
#pragma once
#include "Engine.h"
namespace Octane
{
	struct Matrix : public D3DXMATRIX
	{
	public:
		Matrix();
		Matrix( const Matrix& );
		Matrix( const D3DXMATRIX& );
		Matrix& operator=( const Matrix& );
		Matrix& operator=( const D3DXMATRIX& );
		void setZero();
		void setIdentity();
		void Fill( int );
		void Fill( float );
		void Fill (double );
		void Translate( float x, float y, float z );
		void Translate( Vector3& );
		void rotateYawPitchRoll( float x, float y, float z );
		void rotateYawPitchRoll( Vector3& );
		void rotateX( float );
		void rotateY( float );
		void rotateZ( float );
		void Scale( float x, float y, float z );
		void Scale( Vector3& );
	};
};


Thank you for your time, and sorry for hassle.

p.s. I am very new to this, but determined to learn it.



where is the body for the costructor on line 10 (Matrix.h)?
Dont matter, Ive noticed ive missed off

1
2
3
4
Matrix::Matrix( const D3DXMATRIX& M ) : D3DXMATRIX(M)
{
*this = M;
}


in the matrix.ccp
congrats you found the missing link ;)
Topic archived. No new replies allowed.