Can't figure out this error

I'm using VS 2010. I keep getting

Error 1 error LNK2019: unresolved external symbol "void __cdecl printRaceGoblin(void)" (?printRaceGoblin@@YAXXZ) referenced in function "int __cdecl pRaceChoose(void)" (?pRaceChoose@@YAHXZ) C:\Users\Austin\documents\visual studio 2010\Projects\Kingdom Borjek oyk Lok\Kingdom Borjek oyk Lok\PlayerChooseRace.obj
Error 2 error LNK1120: 1 unresolved externals C:\Users\Austin\documents\visual studio 2010\Projects\Kingdom Borjek oyk Lok\Debug\Kingdom Borjek oyk Lok.exe 1


From what I can tell it's getting confused about a function that isn't properly setup to be in other files? I can't seem to figure this out.

These are the source files that I think are relevant to post. It seems like it has a problem with my void function that prints info about the Goblin Race.

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
 
// PlayerRaceOptions.h

#ifndef PLAYERRACEOPTIONS_H_INCLUDED
#define PLAYERRACEOPTIONS_H_INCLUDED
#include "PlayerInfo.h"
#include "PlayerChooseRace.h"

#include<iostream>
#include<string>
int pRaceChoose();
void printRaceHuman();
void printRaceDwarf();
void printRaceGoblin();
void printRaceOrc();
void printRaceTorven();
void printRaceTreavynr();
void printRaceOrstin();
void printRaceNyaskar();
void printRaceTroll();



#endif


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

// PlayerRaceOptions.cpp

#include<iostream>
#include<string>
#include"PlayerInfo.h"
#include"PlayerChooseRace.h"

using namespace std;



void printRaceHuman()
{
	cout << "Humans are adaptable beings" << endl;
	cout << "from several parts of the world" << endl;
	cout << "They are a young race but have been quite" << endl;
	cout << "quite successful." << endl; 
	cout << " " << endl;
	cout << "Humans are moderately intelligent, and are skilled" << endl;
	cout << "However, they are naturally physically weak" << endl;
	cout << "Only the greatest warriors of humans can match" << endl;
	cout << "the strength of other races such as orcs and dwarves" << endl;
	cout << " " << endl;
	return;
}

void printRaceDwarf()
{
	cout << "Dwarves are an ancient race from mountians" << endl;
	cout << "in the north" << endl;
	cout << "They are are the ancestors of humans, and" << endl;
	cout << "the oldest enemy of goblins" << endl;
	cout << " " << endl;
	cout << "Dwarves are strong and hardy, they are" << endl;
	cout << "very skilled with magic, but they have" << endl;
	cout << "little energy to work with" << endl;
	cout << " " << endl;
}

void printRaceGolbin()
{
	cout << "Goblins are rather mysterious creatures" << endl;
	cout << "The world is unsure of how long they have" << endl;
	cout << "been amongst others. Some believe however" << endl;
	cout << "that are very ancient" << endl;
	cout << "Golins are small and weak, but their way" << endl;
	cout << "of thought gives them a natural mastery of magic" << endl;

}

void printRaceOrc()
{
	cout << "Orcs are highly misunderstood and have many myths about them" << endl;
	cout << "They live in the south east highlands, and are rather young" << endl;
	cout << "Orcs are the fiercest enemies of humans, yet are closely" << endl;
	cout << "related, only dwarves share more blood with them." << endl;
	cout << "Orcs are quite strong, and are more intelligent than" << endl;
	cout << "many think." << endl;
}

void printRaceTorven()
{
	cout << "The Torven did not appear in Almirtin until late in N 500." << endl;
	cout << "They originally came as invading rouges from the southern shores" << endl;
	cout << "Due to this, they suffer much discrimination. However, to this day" << endl;
	cout << "the Torven still continue to rattle the Southern world." << endl;
}

void printRaceTreavynr()
{
	cout << "The Treavynre are no ordinary race. They are literally are of trees." << endl;
	cout << "Their were created long before the 2nd world, by the oldest ancients." << endl;
	cout << "No one to this day knows who..." << endl;
	cout << " There strength is immense, and their skill with magic fine as well." << endl;
}

void printRaceOrstin()
{
	cout << "The Orstins have a similar background to the Torven. They were" << endl;
	cout << "invaders from the west, although it was long ago during the beginning" << endl;
	cout << "of the third world. Their strength is immense, only one non-giant race" << endl;
	cout << "can boast a more natural physique." << endl;
}

void printRaceNyaskar()
{
	cout << "The Nyaskar are an ancient race. Only the Treavynre have seen and done more." << endl;
	cout << "Their strength is incredible, only Trolls and Treavynre are stronger." << endl;
	cout << "They are naturally tempered, and when enfuriated will release flames" << endl;
	cout << "apon the unfortunate foe. They are the kin of dragons." << endl;
	cout << "The Nyaskar are feared for amazing physique and natural skill with magic" << endl;
	cout << "however, their motor skills are greatly limited, and the words" << endl;
	cout << "finesse and Nyaskar have rarely properly gone together" << endl;
}

void printRaceTroll()
{
	cout << "Trolls are the Titans of Physique in the world of Almirtin." << endl;
	cout << "In fact, the trolls are considered by some to be the oldest race" << endl;
	cout << "in the world. However, they have an ancestor, known as the Ugrot" << endl;
	cout << "who while similar, was different enough to be considered different" << endl;
	cout << "When an army doesn't have siege equipment, a troll is the likely" << endl;
	cout << "subsitute. They are known to wrestle young dragons, and beat down" << endl;
	cout << "N'lagora, the giant spiders of the Great Eastern Mountians." << endl;
	cout << "However, the amount of magic capable trolls is the same as" << endl;
	cout << "the amount of gems ever owned by a peasant. They simply are" << endl;
	cout << "unable to grasp magic." << endl;
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

// PlayerChooseRace.h

#ifndef PLAYERCHOOSERACE_H_INCLUDED
#define PLAYERCHOOSERACE_h_INCLUDED

#include "PlayerInfo.h"
#include "PlayerRaceOptions.h"

#include<iostream>
#include<string>

int pChooseRace();






#endif 


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

// PlayerChooseRace.cpp

#include "PlayerInfo.h"
#include "PlayerRaceOptions.h"

#include<iostream>
#include<string>

using namespace std;

int pRaceChoose() // This is for choosing the race
{
	int pRace = 0;
	int pRaceDefined = 0;
	int seeRace;
	int cpRaceYN;
	
	while(pRaceDefined = 0)
	{ //While Bracket
	cin >> seeRace;

	if (seeRace == 1)
	{
		printRaceHuman();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
		cout << "1:Yes" << endl;
		cout << "2:No" << endl;
		cin >> cpRaceYN;
		if (cpRaceYN == 1)
		{
			int pRace = 1;
			int pRaceDefined = 1;
			cout << "You are now a human" << endl;
		} // If bracked here
		if (cpRaceYN == 2) 
		{
			cout << "Ok" << endl;
		}// If bracket here

	} //Function Bracket here

	
	if (seeRace == 2)
	{
		printRaceDwarf();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
		cin >> cpRaceYN;
		if (cpRaceYN == 1)
		{ 
			int pRace = 2;
			int pRaceDefined = 1;
			cout << "You are now a Dwarf" << endl;
		}//Lower If
		if (cpRaceYN == 2)
		{
			cout << "Ok" << endl;
		}//Lower If
			

		
	}//Higher If Bracket

	
	if (seeRace == 3)
	{
		printRaceGoblin();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
	}// Higher If

	if (seeRace == 4)
	{
		printRaceOrc();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
	}
	if (seeRace == 5)
	{ 
		printRaceTorven();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
	}
	if (seeRace == 6)
	{
		printRaceTreavynr();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
	}
	if (seeRace == 7)
	{
		printRaceOrstin();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
	
	}

	if (seeRace == 8)
	{
		printRaceNyaskar();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;
	}

	if (seeRace == 9)
	{
		printRaceTroll();
		cout << " " << endl;
		cout << "Is this your desired race?" << endl;

	}//Ifbracket


	}//While Bracket
	return 0;
}//Function Bracket
in PlayerChooseRace.h, you've got one function prototype :
int pChooseRace();
but in PlayerChooseRace.cpp, you've defined it as :
int pRaceChoose()
Last edited on
Ok I changed it, unfortuanetly I'm still getting the error.
in PlayerRaceOptions.cpp
1
2
3
4
5
6
7
8
void printRaceGolbin()
{
	cout << "Goblins are rather mysterious creatures" << endl;
	cout << "The world is unsure of how long they have" << endl;
	cout << "been amongst others. Some believe however" << endl;
	cout << "that are very ancient" << endl;
	cout << "Golins are small and weak, but their way" << endl;
	cout << "of thought gives them a natural mastery of magic" << endl;

its just a spelling error printRaceGolbin should be printRaceGoblin
or its in playerRaceOptions.h since it was declared as
void printRaceGoblin();
take your pick its just a mismatch in spelling and one or the other needs to be switched.
Last edited on
Thank you so much! I really need to work on my debugging skills though, I feel kind of ashamed now. Do you know of any good articles on it?
my personal way of choice http://en.wikipedia.org/wiki/Rubber_duck_debugging
also just compile often so you can catch errors like this fast so you dont have to debug as much code at a time
Last edited on
Topic archived. No new replies allowed.