Unresolved External

Little help, I get the unresolved external error, anyone know why?:
1>TopDownChap6.obj : error LNK2019: unresolved external symbol "void __cdecl DisplayInfo(class apstring,int,int,int,double,double)" (?DisplayInfo@@YAXVapstring@@HHHNN@Z) referenced in function _main
1>C:\Users\Owner\Desktop\Programming Course VS+\Programming1\Debug\ProgrammingCourse.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

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
  #include <iostream>
#include <c:/cpp/apstring.h>
using namespace std;
int GetDay();
int GetStarting();
int GetFinish();
int FindLength(int,int);
double FindRate(int,int,int);
double FindCost(int,double);
apstring FindDayname(int);
void DisplayInfo(apstring,int,int,int,double,double);

int main()
{
	int Day = GetDay();
	int Start = GetStarting();
	int End = GetFinish();
	int Length = FindLength(Start,End);
	double Rate = FindRate(Day,Start,End);
	double Cost = FindCost(Length,Rate);
	apstring DayName = FindDayname(Day);
	DisplayInfo(DayName,Start,End,Length,Rate,Cost);
	cout << Cost << endl;
	system("Pause");
}
int GetDay()
{
	int aDay;
	cout <<"Please type in the Day of the Week with a number(1:Sunday,2:Monday...7:Saturday)" << endl;
	cin >> aDay;
	return aDay;
}
int GetStarting()
{
	int aStart;
	cout <<"Please type in the starting time using military time(7:30PM would be 1930)" << endl;
	cin >>aStart;
	return aStart;
}
int GetFinish()
{
	int aFinish;
	cout << "Please type in the ending time using military time(7:30PM would be 1930)" << endl;
	cin >> aFinish;
	return aFinish;
}
int FindLength(int Start,int End)
{
	int aLength;
	if (End<Start) aLength = 2400-Start+End;
	else if (End>=Start) aLength = End-Start;
	return aLength;
}
double FindRate(int Day,int Start,int End)
{
	double aRate;
	if (Day==7) aRate=.4;
	else if (Day==1 && Start >=0 && Start <=1700 && End >=0 && End <= 1700) aRate=.40;
	else if (Start >= 1700 && Start <= 2300 && End >= 1700 && End <=2300) aRate= .20;
	else if (Start >=2300 && Start <= 2400 || Start >=0 && Start <=700)
	{
		if (End >=2300 && End <= 2400 || End >=0 && End <=700) aRate=.40;
	}
	else aRate=0.00;
	return aRate;
}
double FindCost(int Length,double Rate)
{
	double aCost= (Length * .11) * (1-Rate);
	return aCost;
}
apstring FindDayname(int Day)
{
	apstring aDayName;
	if (Day==1) aDayName="Sunday";
	else if (Day==2) aDayName="Monday";
	else if (Day==3) aDayName="Tuesday";
	else if (Day==4) aDayName="Wednesday";
	else if (Day==5) aDayName="Thursday";
	else if (Day==6) aDayName="Friday";
	else if (Day==7) aDayName="Saturday";
	return aDayName;
}
void DisplayInfo(apstring DayName,int Start,int End,int Length,int Rate,int Cost)
{
	cout <<"Day				" << DayName << endl;
	cout <<"Calling Time	" << Start << endl;
	cout <<"Ending Time		" << End << endl;
	cout <<"Length of Call	" << Length << endl;
	cout <<"Cost			" << Cost << endl;
	cout <<"Discount %		" << Rate*100 << "%" << endl;
	return;
}
Last edited on
You have conflicting prototype declaration (line 11) and function definition (line 84).

void DisplayInfo(apstring,int,int,int,double,double);

void DisplayInfo(apstring DayName,int Start,int End,int Length,int Rate,int Cost)
You need to decide which is correct, and then make them both agree.
Your declaration on line 11 does not match (with respect to types) to your definition on line 84. When you call DisplayInfo on line 22, there is no function that has a definition to match the arguments you passed to it.

Line 11: Takes an apstring, 3 ints, then 2 doubles.
Line 84: Takes an apstring, then 5 ints.
Last edited on
Wow, I feel stupid, Thanks for the help
Topic archived. No new replies allowed.