Problem compiling Phonebook app LNK2019 error

Hey guys, title says it all pretty much. I'm having problems compiling my phonebook application. I get the two errors: Error 1 error LNK2019: unresolved external symbol "public: __thiscall phonebook::phonebook(void)" (??0phonebook@@QAE@XZ)
LNK1120 unresolved externals
Would appreciate any tips to solving this problem. Thanks!

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
  #include <iostream>
#include <string>

//better to specify? or just use using namespace std;???
using std::string;
using std::cout;
using std::cin;
using std::endl;

//address book size
const int ARRAY_SIZE = 25;

class phonebook {
	string first_name;
	string last_name;
	string names[ARRAY_SIZE];
	int numbers[ARRAY_SIZE];
	int phone_number;
	bool validatePhoneNumber(int phoneNumber)
	{
		/*TODO*/
		// no idea yet
		return true;
	}
	void formatPhoneNumber(int phoneNumber)
	{
		//TODO
		// no idea yet
	}
public:
	//constructors
	phonebook();

	// Accessors
	void setFirstName(string firstName)
	{
		first_name = firstName;
	}
	string getFirstName()
	{
		return first_name;
	}
	void setLastName(std::string lastName)
	{
		last_name = lastName;
	}
	string getLastName()
	{
		return last_name;
	}
	void setPhoneNumber(int phoneNumber)
	{
		//sets phone number if it validates as a phonenumber
		if (validatePhoneNumber(phoneNumber))
		{
			phone_number = phoneNumber;
		}
	}
	int getPhoneNumber()
	{
		return phone_number;
	}

	void addEntry(string fname, string lname, int phoneNumber)
	{

	}
	void displayBook()
	{
		for (int i = 0; i < ARRAY_SIZE; i++)
		{
			cout << names[i] << ": " << numbers[i] << endl;
		}
	}
};
int main()
{
	phonebook pb;
	int choice;
	cout << "Phonebook" << endl << endl;
	cout << "1. Add Entry" << endl;
	cout << "2. View Current Entries" << endl;
	cin >> choice;
	if (choice == 1)
	{
		string fname, lname;
		int phone_number;
		bool exit = false;
		do {
			cout << "Entry's first name: ";
			cin >> fname;
			cout << endl;
			cout << "Entry's last name: ";
			cin >> lname;
			cout << endl;
			cout << "Entry's phone number";
			cin >> phone_number;
			pb.addEntry(fname, lname, phone_number);
			char anotherEntry;
			cout << "Add another entry? y/n: ";
			cin >> anotherEntry;
			if (anotherEntry == 'n')
				exit = true;
		} while (exit == false);
	}
	else if (choice == 2)
	{
		pb.displayBook();
	}
	return 0;
}
You've declared a phonebook::phonebook() constructor on line 32, but you haven't defined it (given it a body).
damn... thanks lol
Topic archived. No new replies allowed.