error LNK2019: unresolved external symbol

Hello I tried to look in other questions but I didn't get the answer. I still can't understand when exactly this error shows up and now it is in my code.

The code is not finished yet I just wanted to see if it copiles correctly so far so there are a lot of unlogical things in it but it still have to compiles but I get this error message:

> Chast1.obj : error LNK2019: unresolved external symbol "public: int __thiscall Robot::getX(void)" (?getX@Robot@@QAEHXZ) referenced in function "void __cdecl RobotMovement(class Robot * const,int * const,int,int)" (?RobotMovement@@YAXQAVRobot@@QAHHH@Z)
1>C:\Users\User\Documents\Visual Studio 2012\Projects\Mega_prazna_igra\Debug\Mega_prazna_igra.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



I have 2 header files:
Robot.h and Stats.h
and 3 source files

Robot.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
#include "Robot.h"


Robot::Robot(void)
{
  x=0;
  y=0;
  dir=0;
}


Robot::~Robot(void)
{
}
char direc[4]={'W','S','E','N'};
int moveX[4]={0,1,0,-1};
int moveY[4]={-1,0,1,0};

void Robot::robot1(int stX,int stY)

{ x=stX;
  y=stY;
  dir=0;

}

void Robot::turnLeft()
{
	dir=(dir+3)%4;
};
void Robot::turnRight()
{
	dir=(dir+1)%4;
}
void Robot::move()
{
	x=x+moveX[dir];
	y=y+moveY[dir];
}
void Robot::moveBack()
{
	x=x-moveX[dir];
	y=y-moveY[dir];
	dir=(dir+2)%4;
}


int Robot::getY() 
{
	return y;
}
char Robot::getDir() 
{
	return direc[dir];
}
int Robot::TakeFrontX()
{
	return x+moveX[dir];
}
int Robot::takeFrontY()
{
	return y+moveY[dir];
}


void Robot::moveWest()
{
	dir=0;
	y=y-1;
}

void Robot::moveEast()
{
	dir=2;
	y=y+1;
}
void Robot::moveNorth()
{
	dir=3;
	x=x-1;
}
void Robot::moveSouth()
{
	dir=1;
	x=x+1;
}


stats.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
#include "Stats.h"



Stats::Stats(void)
{
}


Stats::~Stats(void)
{
}
int Stats::getAtt()
{
	return att;
}
int Stats::getDef()
{
	return def;

}
int Stats::getBlock()
{
	return block;
}
int Stats::getChanceToShoot()
{
	return chanceToShoot;
}
int Stats::getDodge()
{
	return dodge;
}
int Stats::getHealth()
{
	return health;
}
bool Stats::getInGamez()
{
	return inGamez;
}
char Stats::getRace()
{
	return race;
}
int Stats::getmovSpeed()
{
	return movSpeed;
}


and the chast1
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include <iostream>
#include <conio.h>
#include <windows.h>
#include "Robot.h"
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */

using namespace std;
const int MAXROB=5;
const int MaxX=10,maxY=10;
void orderOfPlay(int order[MAXROB],Robot roboti[MAXROB])
{
	    
	for(int i=0;i<MAXROB;i++)
		{   int max=0,maxNum;
			for(int j=0;j<MAXROB;j++)
			{
				if(roboti[j].getmovSpeed()>max)
				{
					int checkIn=0;
			       for(int k=0;k<i;k++)
				     if(order[k]==j)
						 checkIn=1;
				   if(checkIn==0)
				   {
					   maxNum=j;
					   max=roboti[j].getmovSpeed();
				   }
				}
			}
			order[i]=maxNum;
	}
}

void bitka(Robot A,Robot B)
{
}

void RobotMovement(Robot roboti[MAXROB],int order[MAXROB],int inGame,int br)
{  int NumOfRob=0;
	for(int i=0;i<inGame;i++)
		{
			
			while(roboti[order[NumOfRob]].getInGamez()!=true)
			{
				NumOfRob++;
			}
		bool done=false;
			while(done==false)
			{

			int movement=rand() % 4+1;
			
			switch(movement)
			{
			case 1:
				{   
					if(roboti[order[NumOfRob]].getY()!=0)
					{
						roboti[order[NumOfRob]].moveWest();
						done=true;
						break;
					}
					
				}

			case 2:
				{
					if(roboti[order[NumOfRob]].getY()<maxY-1)
					{
						roboti[order[NumOfRob]].moveEast();
						done=true;
						break;
					}
					
				}
			case 3:
				{
					if(roboti[order[NumOfRob]].getX()!=0)
					{
						roboti[order[NumOfRob]].moveNorth();
						done=true;
					break;
					}
					
				}
			case 4:
				{
					if(roboti[order[NumOfRob]].getX()<MaxX-1)
					{
						roboti[order[NumOfRob]].moveSouth();
						done=true;
					}
					break;
				}
			}
			}
			
			
			
			int y=roboti[order[NumOfRob]].getY(),x=roboti[order[NumOfRob]].getX();

			for(int j=0;j<br;j++)
			{
				if(j!=order[NumOfRob]&&roboti[j].getInGamez()==true)
				{
					if(x==roboti[j].getX()&&roboti[j].getY()==y)
						bitka(roboti[order[NumOfRob]],roboti[j]);
				}
			}
			NumOfRob++;
          }
}

void map(Robot roboti[MAXROB],int br)
{
	int inGame=br;
	int order[MAXROB];

	orderOfPlay(order,roboti); //Da proverq dali baca tui!
	srand (time(NULL));


	while(inGame!=1)

	{  RobotMovement(roboti,order,inGame,br);
		

	   
	}
}

				
int main()
{
	cout<<"H";
	Sleep(400);
	cout<<"E";
	Sleep(400);
	cout<<"L";
	Sleep(400);
	cout<<"M"<<endl;
	return 0;
}
You didn't define Robot::getX() function.
Read error messages next time, they are really helpful.
I have defined it but I haven't made the "Body" of the function. Yes thank you very much. I'm still learning reading the error messages and understanding what esactly their meaning is xD
Topic archived. No new replies allowed.