Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type name expected, yet #include directives included?

Status
Not open for further replies.

Gonnzo

Programmer
Apr 17, 2003
5
GB
Still developing my program and could use yet more help if anyone has time.

I get the following error on the line of code quoted below:

Error:====================
[C++ Error] Employee.h(19): E2303 Type name expected
Error:====================

code:====================
void EmployeeSwipesCard( int DNo, SecuritySystem pSystem );
code:====================

I don't understand why, my class as you can see below has the line #include "SecuritySystem.h". In my main program I have an instance of SecuritySystem and pointers to it and they all work fine with the #include code.

Can anyone tell me whats wrong, I am guessing its something simple. (or maybe thats just be hoping).

Many thanks,


Employee.h Class


code:====================
#ifndef EMPLOYEE_H
#define EMPLOYEE_H

#include "SwipeCard.h"
#include "SecuritySystem.h"

class Employee {
public:

Employee( std::string F, std::string S, bool Auth, int ID, SwipeCard * pCard );

void DisplayDetails();
int GetID();
bool GetAuthorised() { return Authorised; };
void SetAuthorised( bool Auth );

void EmployeeSwipesCard( int DNo, SecuritySystem pSystem );

private:
std::string Surname;
std::string Forename;
bool Authorised;
int IDNo;
SwipeCard * ptrSCard;
};
#endif
code:====================
 
As far as i see You declares the Class OK but You MUST name a "Variable" and tell it that it's Your Class, i.e.:
new One_Employee Employee;

That line makes the compiler assign memory and such for the variable "One_Employee" which then is a class....and so on.

You can even assign it static by:
Employee One_Employee;

Totte
 
Show us what the SecuritySystem.h file looks like. It might help figure this one out.
 
Thanks guys, but I managed to solve my problem. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top