Click here to Skip to main content
15,941,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
these are the errors I am getting now

VB
1>wk11.obj : error LNK2019: unresolved external symbol "public: void __thiscall Employee::sethours(int)" (?sethours@Employee@@QAEXH@Z) referenced in function "public: void __thiscall Employee::retrievehours(void)" (?retrievehours@Employee@@QAEXXZ)
1>wk11.obj : error LNK2019: unresolved external symbol "public: void __thiscall Employee::setwadges(int)" (?setwadges@Employee@@QAEXH@Z) referenced in function "public: void __thiscall Employee::retrievewadges(void)" (?retrievewadges@Employee@@QAEXXZ)
1>C:\Users\edith\documents\visual studio 2010\Projects\wk11\Debug\wk11.exe : fatal error LNK1120: 2 unresolved externals





C++
#include <iostream>
#include <string>
using namespace std;
class Employee {
private: 
	
	string firstName;
	string lastName;
	int hours;
	int numhours;//removed
	int wadges;
	int twadges;//removed
	int rate;//removed
public:
	// First Name
	string getFirstName() { return firstName; }
	void setFirstName(string name) { firstName = name; }
	void retrieveFirstName() {
		string temp;
		cout << "First Name: ";
		cin >> temp;
		setFirstName(temp);
	}
	// Last Name
	string getLastName() { return lastName;	}
	void setLastName(string name) {	lastName = name; }
	void retrieveLastName() {
		string temp;
		cout << "Last Name: ";
		cin >> temp;
		setLastName(temp);
	}
	// hours
	int gethours() { return hours; }
	void sethours(int hours) {
	void retrievehours() {
	cout << "How many hours? ";
	int temp;
	cin >> temp;
	sethours(temp);
	}
	// wadges
	int getwadges() {return twadges; }
	void setwadges(int wadges) {
	void retrievewadges() {
	cout << "What is your hourly wadge? " ;
	int tempwadges;
	cin >> tempwadges;
	setwadges(tempwadges);
	
	}
		void retrieve() {
		retrieveFirstName();
		retrieveLastName();
		retrievehours();
		retrievewadges();
		
	}
		int grosspay(){
		int total;
		total = twadges * numhours;	
		cout << total;
		}
		return total;
}
};
int main()
	Employee name;
	name.retrieve();
	cout << "Grosspay " << name.grosspay() << endl;
	system("pause");
	return 0;
}
Posted
Updated 19-Nov-10 9:48am
v3

At first glance, it looks like you have no opening brace for int main().

Beyond that, I have found it very helpful NOT to use the style
C#
int main() {
 //code
}

Instead, I will use
C#
int main() 
  {
    //code
  }

Put the braces in their own column, indented from the block they start, line up the opening and closing braces and indent the code inside the block from the braces. When you have several pages of code to scan, you can simply pull out a pencil and a ruler and make sure everything lines up properly and that every opening has a closing.
 
Share this answer
 
This part of your code looks really strange:

// hours
int gethours() { return hours; }
void sethours(int hours) {
void retrievehours() {
cout << "How many hours? ";
int temp;
cin >> temp;
sethours(temp); }
 
Share this answer
 
I'm surprised you code compiles - you've got unbalanced braces all over the place and what would be nested functions (that C++ doesn't support) if you'd had the same number of opening and closing braces [1]. So go through your code making sure that for every opening brace there's a closing one - when you get to setwadges you'll see that you've started defining a function and then immediately started defining another one.

One final bit of advice - if you're not sure about how to spell things try running your source code through a speller or just check your variable names. If you've got weird spellings of things it can be very hard for people to work out what your code means.

Cheers,

Ash

[1] I've just run your code through a quick test on 6 compilers and none of them accepted it as you've presented it above. It didn't go anywhere near the linker.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900