can anyone please point out what's wrong with the files linking?

i have this compiling errors:


1>c:\documents and settings\lih\my documents\visual studio 2005\projects\employee\employee\hourlyemployee.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\lih\my documents\visual studio 2005\projects\employee\employee\hourlyemployee.cpp(4) : error C2550: 'HourlyEmployee' : constructor initializer lists are only allowed on constructor definitions
1>c:\documents and settings\lih\my documents\visual studio 2005\projects\employee\employee\hourlyemployee.cpp(6) : warning C4508: 'HourlyEmployee' : function should return a value; 'void' return type assumed

------------------------------------------ first file-----------------------------------------
# ifndef EMPLOYEE_H
# define EMPLOYEE_H


# include <string>
# include <iostream>
using namespace std;

namespace employeeTry
{

class Employee
{
public:
	Employee();
	Employee(string, string, string);
	void setLastName(string);
	void setFirstName(string);
	void setSSN(string);
	string getFirstName();
	string getLastName();
	string getSSN();
	void output();


private: 
	string lastName;
	string firstName;
	string ssn;
};


}//end of employeeTry


#endif 
---------------------------------------first file end----------------------

# ifndef hourlyEmployee_h
# define hourlyEmployee_h

# include "employee.h"
# include <string>

namespace employeeTry
{
	class HourlyEmployee: public Employee
	{
	public:
		HourlyEmployee();
		HourlyEmployee(string,string,string,double,double);

	private: 
		double hourlyRate;
		double hours;
	};



}


#endif 
--------------------------------- second file end (hourlyEmployee)--------------------

# include "hourlyEmployee.h"

HourlyEmployee::HourlyEmployee(): Employee(), hourlyRate(0), hours(0)
{

}

/*
HourlyEmployee::HourlyEmployee(string ln, string fn, string ss, double hr, double h): lastName(ln), firstName(fn), ssn(ss), hourlyRate(hr), hours(h)
{

}
*/

----------------------------end of the 3rd file (hourlyEmployee.cpp file)

#ifndef hourlyEmployee_h
#define hourlyEmployee_h
#include "employee.h"

i dont think the file employee.h is getting included at all. You should do

#ifndef hourlyEmployee_h
#include "employee.h"
#endif

or infact you dont need to use the ifndef while including the file if you have already used them in the header file.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.