 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tim Howard Guest
|
Posted: Wed Apr 28, 2004 8:43 pm Post subject: Type name expected, header file problem |
|
|
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
|
Posted: Wed Apr 28, 2004 9:23 pm Post subject: 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:
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
|
Posted: Wed Apr 28, 2004 9:35 pm Post subject: 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:
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
|
Posted: Thu Apr 29, 2004 1:35 pm Post subject: 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:
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 |
|
 |
|
|
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
|
|