Error?

Hey everyone, I'm getting an error using cout and I have no idea why. It occurs in both implementation files, can anyone help?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef H_personType
#define H_personType
#include <string>

using namespace std;

class personType
{
public:
	void print() const;
	void setName(string, string);
	string getFirstname() const;
	string getlastName() const;
	personType(string first = "", string last = "");
private:
	string firstName;
	string lastName;
};
#endif 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef H_fullTimeEmployee
#define H_fullTimeEmployee

#include "employeeType.h"

class fullTimeEmployee: public employeeType
{
public:
	void set(string,string,long,double,double);
	void setSalary(double);
	double getSalary();
	void setBonus(double);
	double getBonus();
	void print() const;
	double calculatePay() const;
	fullTimeEmployee(string first = "", string last = "",
		long id = 0, double salary = 0, double bonus = 0);
private:
	double empSalary;
	double empBonus;
};
#endif 





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
#include "personType.h"

using namespace std;

void personType::print() const
{
	cout << firstName << " " << lastName;
}

void personType::setName(string first, string last)
{
	firstName = first;
	lastName = last;
}

string personType::getFirstname() const
{
	return firstName;
}

string personType::getlastName() const
{
	return lastName;
}

personType::personType(string first, string last)
{
	firstName = first;
	lastName = last;
}




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
#include "fullTimeEmployee.h"

using namespace std;

void fullTimeEmployee::set(string first, string last,
						   long id,
						   double salary, double bonus)
{
	setName(first,last);
	setId(id);
	empSalary = salary;
	empBonus = bonus;
}

void fullTimeEmployee::setSalary(double salary)
{
	empSalary = salary;
}

double fullTimeEmployee::getSalary()
{
	return empSalary;
}

void fullTimeEmployee::setBonus(double bonus)
{
	empBonus = bonus;
}

double fullTimeEmployee::getBonus()
{
	return empBonus;
}

void fullTimeEmployee::print() const
{
	cout << "Id: " << getId() << endl;
	cout << "Name: ";
	personType::print();
	cout << endl;
	cout << "Wages: $" << calculatePay() << endl;
}

double fullTimeEmployee::calculatePay() const
{
	return empSalary + empBonus;
}

fullTimeEmployee::fullTimeEmployee(string first, string last,
								   long id, double salary,
								   double bonus)
								   :employeeType(first,last,id)
{
	empSalary = salary;
	empBonus = bonus;
}
Please copy and paste the exact error.

1>c:\users\joseph\documents\visual studio 2008\projects\examples\examples\persontype.cpp(7) : error C2065: 'cout' : undeclared identifier
1>fullTimeEmployee.cpp
1>c:\users\joseph\documents\visual studio 2008\projects\examples\examples\fulltimeemployee.cpp(37) : error C2065: 'cout' : undeclared identifier
1>c:\users\joseph\documents\visual studio 2008\projects\examples\examples\fulltimeemployee.cpp(38) : error C2065: 'cout' : undeclared identifier
1>c:\users\joseph\documents\visual studio 2008\projects\examples\examples\fulltimeemployee.cpp(40) : error C2065: 'cout' : undeclared identifier
1>c:\users\joseph\documents\visual studio 2008\projects\examples\examples\fulltimeemployee.cpp(40) : error C2563: mismatch in formal parameter list
1>c:\users\joseph\documents\visual studio 2008\projects\examples\examples\fulltimeemployee.cpp(40) : error C2568: '<<' : unable to resolve function overload
Did you #include <iostream> in either of the source files? You have to include headers in each source file, not just one.
Heh, Doh!! That solved it, cannot believe I overlooked that. Thanks you for the help.
Topic archived. No new replies allowed.