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)

Recommended Answers

All 2 Replies

#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.

classes/structs must be terminated with a semicolon, which is missing at the end of hourlyEmployee_h

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.