LNK2019 Errors???

Cannot figure out why program has these errors.

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
#include <iostream>
#include <string>
#include <cstdlib>//General Utilities Library for general function purposes

#include "Customer.h"

using namespace std;

//Void Function for Week 2
void greeting()
{
	cout << "Welcome to Golf Ballz Inc! \n";
}

int main()
{
	//declaring variables
	string name, address;
	char response;
	
	string *pCusName, *pCusAddress; //Pointers

	Customer CusInfor;

	pCusName = &name;  //Pointer to reference Name entered
	pCusAddress = &address;  // pointer to reference Address entered	

	CusInfor.setCusName(*pCusName);
	CusInfor.setCusAddress(*pCusAddress);

	//greeting, name and address gathering

	greeting();

	cout << "Please enter your name: \n";

	cin>> name;

		cout << "Pleae enter your shipping address: \n\n";

	cin>> address;
	
		
							  //verifying address
	cout << "Welcome " << pCusName<< "!" << endl << endl;

	cout << "You entered your shipping address as: " << pCusAddress << endl << endl;



	//list of products

	cout << "Here is a list of available products we offer: \n";

	cout << "Mens Golf Ballz \n Come in a variety of hardness and spin control options to rival the Pro's on tour! \n";

	cout << "Womens Golf ballz \n Geared toward our beautiful golf girlz on the course! \n";

	cout << "Kids Golf Ballz \n Offered in a variety of fun colors and designs! \n\n";

	cout << " Each golfer can choose from a variety of colors and designs. \n\n";


	
	string PRODUCT[3] = { "Men's Golf Ballz", "Women's Golf Ballz", "Kids Golf Ballz" };

	int QUANT[3];

	double PRICE[3] = { 23.00, 20.00, 15.00 }; //String with Prices of products pre-determined

	cout << "Product #1 - Men's Golf Ballz are $23.00/dozen" << endl;
	cout << "Product #2 - Women's Golf Ballz are $20.00/dozen" << endl;
	cout << "Product #3 - Kid's Golf Ballz are $15.00/dozen" << endl;

	double total = 0;//inistialize total to zero

	for (int counter = 0; counter < 3; counter++)
	{
		cout << "Enter quantity for Product # " << counter + 1 << ": ";
		cin >> QUANT[counter];// customer enters quantities under each product type

		total += QUANT[counter] * PRICE[counter];//equation to give final total of all products
	}
	cout << "Your total bill is : $" << total << endl; //final statement that gives total bill due

	cout << "Are you finished shopping? (Y/N)";
	cin >> response;
			
		system("PAUSE");

	return 0;
}


Header File
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
// Header = Function Declaration

#include <iostream>
#include <string>

using namespace std;


#ifndef CUSTOMER_H
#define CUSTOMER_H

class Customer {

public:
	void setCusName(string);
	string getCusName();
	void setCusAddress(string);
	string getCusAddress();
	//Default Constructor
	Customer();
	void Customer::setCusName(string name)
	{
		CusName = name;
	}
	void Customer::setCusAddress(string address)
	{
		CusAddress = address;
	}
	//Overload Constructor
	Customer(string);
	

private:
	// Variables
	string newName;
	string newAddress;

Customer(string name, string address);

};

#endif 
Last edited on
What errors? What does the linker actually say, in addition to the "LNK2019"?
Now I'm getting a whole bunch of errors in my .h file... I am so lost at this point.
C2535 error on lines 22, 26 'void Customer::setCusName/setCusAddress(std::string)': member function already defined or declared
C2065 error on lines 23, 27 'CusName/CusAddress;undeclared identifier
There are two ways to place the member implementations:

1. Within the class defition:
1
2
3
4
5
6
7
class Foo {

  int bar( double x ) {
    // code
  }

};


2. Outside of definition:
1
2
3
4
5
6
7
8
9
class Foo {

  int bar( double );

};

int Foo::bar( double x ) {
  // code
}


What you have is external syntax within the definition. Fix that and a lot of errors will disappear.
Is that only with Int variables? Since I'm using 'string' does the definition still apply the same way?
With all types.
Topic archived. No new replies allowed.