BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Type name expected, header file problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE)
View previous topic :: View next topic  
Author Message
Tim Howard
Guest





PostPosted: Wed Apr 28, 2004 8:43 pm    Post subject: Type name expected, header file problem Reply with 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:


http://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
Back to top
Tom Jett
Guest





PostPosted: Wed Apr 28, 2004 9:23 pm    Post subject: Re: Type name expected, header file problem Reply with 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

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:


http://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

Back to top
Tim Howard
Guest





PostPosted: Wed Apr 28, 2004 9:35 pm    Post subject: Re: Type name expected, header file problem Reply with 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:

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:


http://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

Back to top
Tom Jett
Guest





PostPosted: Thu Apr 29, 2004 1:35 pm    Post subject: Re: Type name expected, header file problem Reply with quote

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:


http://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

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.