Board index » cppbuilder » Type name expected, header file problem

Type name expected, header file problem


2004-04-29 04:43:41 AM
cppbuilder103
Greetings,
Here are the two errors I'm getting:
[C++ Error] Setup.h(89): E2303 Type name expected
[C++ Error] Setup.h(89): E2139 Declaration missing ;
I don't know how to do this easily and quickly, but I'll try. There is a
header file for a class I've created. If I comment out it being included
from a Form header file (TSetupForm) and comment out the member variable
I added to that form which is a pointer to the class I've created then
it compiles fine.
I've included this header elsewhere and if I make the changes stated
above then it compiles fine. I am successfully using the class in my
program and it's just when I include it in this one place it freaks out.
If I DON'T include the header file, and just put "class" in front of my
member variable that is a pointer to that class type it compiles fine. I
haven't extensively tried to use that though but I'm assuming it would
work. I have this header file included in the header file of the main
Form that is an MDI Parent to all my other forms. It's very weird.
You can get the source and look at it yourself if anyone wants to. It's
not very big at all as I've just started this program. The link is:
thedigitalkeyholder.com/AnamViewReloaded.zip
Any help would be greatly appreciated. Something strange with header
files is going on, but I can't figure out what. I can't seem to find any
great reference material on C++ and header file handling either.
Surprise, surprise. It's not a glorious aspect I guess.
Cheers and thanks!!!
Tim Howard
 
 

Re:Type name expected, header file problem

<I also posted this one other place, borland.public.cppbuilder.ide>
Sorry if this was incorrect.
Greetings,
Here are the two errors I'm getting:
[C++ Error] Setup.h(89): E2303 Type name expected
[C++ Error] Setup.h(89): E2139 Declaration missing ;
I don't know how to do this easily and quickly, but I'll try. There is a
header file for a class I've created. If I comment out it being included
from a Form header file (TSetupForm) and comment out the member variable
I added to that form which is a pointer to the class I've created then
it compiles fine.
I've included this header elsewhere and if I make the changes stated
above then it compiles fine. I am successfully using the class in my
program and it's just when I include it in this one place it freaks out.
If I DON'T include the header file, and just put "class" in front of my
member variable that is a pointer to that class type it compiles fine. I
haven't extensively tried to use that though but I'm assuming it would
work. I have this header file included in the header file of the main
Form that is an MDI Parent to all my other forms. It's very weird.
You can get the source and look at it yourself if anyone wants to. It's
not very big at all as I've just started this program. The link is:
thedigitalkeyholder.com/AnamViewReloaded.zip
Any help would be greatly appreciated. Something strange with header
files is going on, but I can't figure out what. I can't seem to find any
great reference material on C++ and header file handling either.
Surprise, surprise. It's not a glorious aspect I guess.
Cheers and thanks!!!
Tim Howard
 

Re:Type name expected, header file problem

You have a circular dependency.
In View.h, add a forward declaration for the TSetupForm class like this:
class TSetupForm;
Then, remove the Setup.h include from View.h.
Make sure that you include Setup.h from View.cpp.
Tom
Quote
Greetings,

Here are the two errors I'm getting:


[C++ Error] Setup.h(89): E2303 Type name expected
[C++ Error] Setup.h(89): E2139 Declaration missing ;


I don't know how to do this easily and quickly, but I'll try. There is a
header file for a class I've created. If I comment out it being included
from a Form header file (TSetupForm) and comment out the member variable
I added to that form which is a pointer to the class I've created then
it compiles fine.

I've included this header elsewhere and if I make the changes stated
above then it compiles fine. I am successfully using the class in my
program and it's just when I include it in this one place it freaks out.
If I DON'T include the header file, and just put "class" in front of my
member variable that is a pointer to that class type it compiles fine. I
haven't extensively tried to use that though but I'm assuming it would
work. I have this header file included in the header file of the main
Form that is an MDI Parent to all my other forms. It's very weird.

You can get the source and look at it yourself if anyone wants to. It's
not very big at all as I've just started this program. The link is:


thedigitalkeyholder.com/AnamViewReloaded.zip

Any help would be greatly appreciated. Something strange with header
files is going on, but I can't figure out what. I can't seem to find any
great reference material on C++ and header file handling either.
Surprise, surprise. It's not a glorious aspect I guess.



Cheers and thanks!!!


Tim Howard
 

{smallsort}

Re:Type name expected, header file problem

That did not seem to fix it. I did exactly as you wrote. Did it compile
OK for you, I'm assuming?
Thanks,
Timothy
Tom Jett wrote:
Quote
You have a circular dependency.

In View.h, add a forward declaration for the TSetupForm class like this:

class TSetupForm;

Then, remove the Setup.h include from View.h.

Make sure that you include Setup.h from View.cpp.

Tom

>Greetings,
>
>Here are the two errors I'm getting:
>
>
>[C++ Error] Setup.h(89): E2303 Type name expected
>[C++ Error] Setup.h(89): E2139 Declaration missing ;
>
>
>I don't know how to do this easily and quickly, but I'll try. There is
>a header file for a class I've created. If I comment out it being
>included from a Form header file (TSetupForm) and comment out the
>member variable I added to that form which is a pointer to the class
>I've created then it compiles fine.
>
>I've included this header elsewhere and if I make the changes stated
>above then it compiles fine. I am successfully using the class in my
>program and it's just when I include it in this one place it freaks
>out. If I DON'T include the header file, and just put "class" in front
>of my member variable that is a pointer to that class type it compiles
>fine. I haven't extensively tried to use that though but I'm assuming
>it would work. I have this header file included in the header file of
>the main Form that is an MDI Parent to all my other forms. It's very
>weird.
>
>You can get the source and look at it yourself if anyone wants to.
>It's not very big at all as I've just started this program. The link is:
>
>
>thedigitalkeyholder.com/AnamViewReloaded.zip
>
>Any help would be greatly appreciated. Something strange with header
>files is going on, but I can't figure out what. I can't seem to find
>any great reference material on C++ and header file handling either.
>Surprise, surprise. It's not a glorious aspect I guess.
>
>
>
>Cheers and thanks!!!
>
>
>Tim Howard
 

Re:Type name expected, header file problem

Quote
<I also posted this one other place,
borland.public.cppbuilder.ide>
Sorry if this was incorrect.
Here is incorrect. As you can see from their name, groups with
'cppbuilder' in their name are for C++ Builder. This is the group for
the old Borland C++ compiler.
. Ed
Quote
Tim Howard wrote in message
news:409017c6$ XXXX@XXXXX.COM ...

<I also posted this one other place, borland.public.cppbuilder.ide>
Sorry if this was incorrect.
 

Re:Type name expected, header file problem

Ah, I do apologize kind sir.
Ed Mulroy [TeamB] wrote:
Quote
><I also posted this one other place,
>borland.public.cppbuilder.ide>
>Sorry if this was incorrect.


Here is incorrect. As you can see from their name, groups with
'cppbuilder' in their name are for C++ Builder. This is the group for
the old Borland C++ compiler.

. Ed


>Tim Howard wrote in message
>news:409017c6$ XXXX@XXXXX.COM ...
>
><I also posted this one other place, borland.public.cppbuilder.ide>
>Sorry if this was incorrect.



 

Re:Type name expected, header file problem

It compiled ok for me with BCB v5 after making the modification I
mentioned. Maybe someone that has a copy of whatever version you are
using can chime in...
Tom
Tim Howard wrote:
Quote
That did not seem to fix it. I did exactly as you wrote. Did it compile
OK for you, I'm assuming?


Thanks,



Timothy



Tom Jett wrote:

>You have a circular dependency.
>
>In View.h, add a forward declaration for the TSetupForm class like this:
>
>class TSetupForm;
>
>Then, remove the Setup.h include from View.h.
>
>Make sure that you include Setup.h from View.cpp.
>
>Tom
>
>>Greetings,
>>
>>Here are the two errors I'm getting:
>>
>>
>>[C++ Error] Setup.h(89): E2303 Type name expected
>>[C++ Error] Setup.h(89): E2139 Declaration missing ;
>>
>>
>>I don't know how to do this easily and quickly, but I'll try. There
>>is a header file for a class I've created. If I comment out it being
>>included from a Form header file (TSetupForm) and comment out the
>>member variable I added to that form which is a pointer to the class
>>I've created then it compiles fine.
>>
>>I've included this header elsewhere and if I make the changes stated
>>above then it compiles fine. I am successfully using the class in my
>>program and it's just when I include it in this one place it freaks
>>out. If I DON'T include the header file, and just put "class" in
>>front of my member variable that is a pointer to that class type it
>>compiles fine. I haven't extensively tried to use that though but
>>I'm assuming it would work. I have this header file included in the
>>header file of the main Form that is an MDI Parent to all my other
>>forms. It's very weird.
>>
>>You can get the source and look at it yourself if anyone wants to.
>>It's not very big at all as I've just started this program. The link is:
>>
>>
>>thedigitalkeyholder.com/AnamViewReloaded.zip
>>
>>Any help would be greatly appreciated. Something strange with header
>>files is going on, but I can't figure out what. I can't seem to find
>>any great reference material on C++ and header file handling either.
>>Surprise, surprise. It's not a glorious aspect I guess.
>>
>>
>>
>>Cheers and thanks!!!
>>
>>
>>Tim Howard