unresolved external symbol error?

I was wondering why I keep getting this error, 1>main.obj : error LNK2019: unresolved external symbol "public: float __thiscall sodamachine::displayChoices(float,float,float,float,float,float,float,float,float,float)" (?displayChoices@sodamachine@@QAEMMMMMMMMMMM@Z) referenced in function _main

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
// This program is for a soda machine and uses structures and functions to make a menu style for a soda machine
// Marcus Zizzo
// ITSE 1307 1021

#include <iostream>
#include <string>

using namespace std;

class sodamachine
{
public:

	float displayChoices(float colaQuantity, float colaCost, 
						float rbQuantity, float rbCost,
						float OsodaQuantity, float OsodaCost, 
						float GsodaQuantity, float GsodaCost,
						float BWquantity, float BWcost);
	int buyDrink(float, int);
};

struct soda
{
	char name[20];
	float quantity;
	float cost;
};
int main()
{
	sodamachine soda1;
	soda Cola, RootBeer, OSoda, GSoda, BottledWater;

	Cola.name[0] = 'Cola';
	Cola.quantity = 20;
	Cola.cost = .75;
	RootBeer.name[1] = 'RB';
	RootBeer.quantity = 20;
	RootBeer.cost = .75;
	OSoda.name[1] = 'OS';
	OSoda.quantity = 20;
	OSoda.cost = .75;
	GSoda.name[0] = 'GS';
	GSoda.quantity = 20;
	GSoda.cost = .75;
	BottledWater.name[0] = 'BW';
	BottledWater.quantity = 20;
	BottledWater.cost = .75;
	
	soda1.displayChoices(Cola.quantity, Cola.cost, 
					RootBeer.quantity, RootBeer.cost, 
					OSoda.quantity, OSoda.cost, 
					GSoda.quantity, GSoda.cost,
					BottledWater.quantity, BottledWater.cost);



	return(0);
}





float displayChoices(float colaQuantity, float colaCost, 
						float rbQuantity, float rbCost,
						float OsodaQuantity, float OsodaCost, 
						float GsodaQuantity, float GsodaCost,
						float BWquantity, float BWcost)
{
	float choice;

	cout << "Cola " << colaQuantity  << " " << colaCost  << endl;
	cout << "Root Beer " << rbQuantity    << " " << rbCost    << endl;
	cout << "Orange Soda " << OsodaQuantity << " " << OsodaCost << endl;
	cout << "Grape Soda " << GsodaQuantity << " " << GsodaCost << endl;
	cout << "Bottled Water " << BWquantity    << " " << BWcost    << endl;
	cin >> choice;

return(choice);
}
You've declared a method sodamachine::displayChoices.

You've defined a global function called displayChoices.

I don't see a definition for sodamachine::displayChoices anywhere in the code you've posted.
Thank you very much I didn't realize that I did not link the definition to the class.
Topic archived. No new replies allowed.