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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[C++ Error] E2303 Type name expected

Status
Not open for further replies.

GaSaUl

Programmer
Nov 23, 2008
2
PE
codes are these:
(Umar.h)
//---------------
#ifndef UmarH
#define UmarH
#include <ExtCtrls.hpp>
#include "Umar1.h"
//---------------
class Cmar
{protected:
int x;
int y;
long int cf;
public:
Cmar (int px,int py,long int pcf);
~Cmar();
virtual void move1(TPaintBox *P);
virtual void move2(TPaintBox *P);
virtual void move3(TPaintBox *P);
};
#endif

(Umar1.h)
//----------------
#ifndef Umar1H
#define Umar1H
#include <ExtCtrls.hpp>
#include "Umar.h"
//----------------
class Cmar1: public Cmar
{private:
long int col1;
int r1;
int r2;
int turn;
public:
Cmar1(int px,int py,long int pcf);
~Cmar1();
void changecol();
void changeturn();
void show1(TPaintBox *P);
void hide1(TPaintBox *P);
void move1(TPaintBox *P);
void move2(TPaintBox *P);
};
#endif


But when I try to run it, an error appears saying [C++ Error] Umar1.h(10): E2303 Type name expected.

 
I think the problem may lie in the fact that you have included Umar1.h in the Umar.h file. This causes the problem because the umar1.h defines the class Cmar1 which is a decendant of Cmar, which is declared in umar.h. Now because you have included umar1.h above the declaration for the decendant class Cmar, the compiler has no idea what a Cmar is when it comes to the declaration for Cmar1.
Try removing the include for Umar1.h from Umar.h and betcha that'll do 'er.
 
You were right, that solved the problem. Thank you very much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top