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!

Type name expected, but IT IS A TYPE!!! 1

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
Hallo.
If, on my form's opening, I declare the following:

arr=new Tball_arr(23);

... I have no problem (Tball_arr is a class with nothing I can spot wrong in it).

However, if I try to declare it in the form's header, I get two bitchy errors - one about an expected ';' in the line (it's there), and the first telling me that a type name was expected.
I get the feeling I've come across this before, but I've no idea how (if I didn't just say 'stuff it') I fixed it.

Does anyone have any idea what this could be?

Cheers,
Douglas Common sense is what tells you the world is flat.
 
I've run into this before,
If memory serves me right, I believe if you declare the class in the header file above the class declaration, you will be ok.

for example if you have a Form called Main:

class Tball_arr;

class TFrmMain : public TForm
{
yada;
yada;
yada;
}
 
Would I then be able to access it from another form? I tried it as a global (sorry, anyone who reads that!), and I couldn't access it.

Cheers,
Douglas JL
Common sense is what tells you the world is flat.
 
you should be able to as long as you declare the instance of the class as public in the form.

//FrmMain.h

class Tball_arr;

class TFrmMain : public TForm
{
yada;
yada;
yada;
public:
Tball_arr TheArrays[32];
}
 
The two stars are cuz that's been getting right up my nose for ages now! Thanks alot, man!

Douglas JL
Common sense is what tells you the world is flat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top