* Does not name a type
@ 2005-06-11 5:46 corey taylor
2005-06-13 1:31 ` corey taylor
0 siblings, 1 reply; 4+ messages in thread
From: corey taylor @ 2005-06-11 5:46 UTC (permalink / raw)
To: gcc-help
I am testing a library build with 4.0 and am having a strange issue
with a typdef that I cannot explicitly tie to a c++ spec requirement
or point.
This is not the same code but the same sequence as the classes are a
little large:
file1.h:
typedef ReferenceCountedPointer< class VARArea > VARAreaRef;
class VARArea : public ReferenceCountedObject { .. };
file2.h:
#include "file1.h"
VARAreaRef area;
at the point gcc errors saying that VARAreaRef does not name a type.
It didn't error when VARAreaRef was used in file1.h later in the class
definition.
corey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Does not name a type
2005-06-11 5:46 Does not name a type corey taylor
@ 2005-06-13 1:31 ` corey taylor
2005-06-13 7:11 ` Arturas Moskvinas
0 siblings, 1 reply; 4+ messages in thread
From: corey taylor @ 2005-06-13 1:31 UTC (permalink / raw)
To: gcc-help; +Cc: Eljay Love-Jensen
This oddity was fixed by removing an include to a .h that also
included the file included from.
Simply using a forward declaration of the class in the .h that
included the file included from here -- which contained the typedef,
resulted in a proper build.
The error message was rather confusing and threw me off :)
Using the analogy below: file1.h included a file3.h that included
file1.h and this caused the error when file2.h included file1.h
corey
On 6/11/05, corey taylor <corey.taylor@gmail.com> wrote:
> I am testing a library build with 4.0 and am having a strange issue
> with a typdef that I cannot explicitly tie to a c++ spec requirement
> or point.
>
> This is not the same code but the same sequence as the classes are a
> little large:
>
> file1.h:
>
> typedef ReferenceCountedPointer< class VARArea > VARAreaRef;
>
> class VARArea : public ReferenceCountedObject { .. };
>
> file2.h:
>
> #include "file1.h"
>
> VARAreaRef area;
>
> at the point gcc errors saying that VARAreaRef does not name a type.
>
> It didn't error when VARAreaRef was used in file1.h later in the class
> definition.
>
> corey
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Does not name a type
2005-06-13 1:31 ` corey taylor
@ 2005-06-13 7:11 ` Arturas Moskvinas
2005-06-13 14:39 ` corey taylor
0 siblings, 1 reply; 4+ messages in thread
From: Arturas Moskvinas @ 2005-06-13 7:11 UTC (permalink / raw)
To: corey taylor; +Cc: gcc-help
I do not know, you might already know it. Make your header files
multitiple include "friendly". Simply put some preprocessor
directives:
#ifndef __file_1_h_
#define __file_1_h_
/*your declaration and so on...*/
#endif
Arturas Moskvinas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Does not name a type
2005-06-13 7:11 ` Arturas Moskvinas
@ 2005-06-13 14:39 ` corey taylor
0 siblings, 0 replies; 4+ messages in thread
From: corey taylor @ 2005-06-13 14:39 UTC (permalink / raw)
To: Arturas Moskvinas; +Cc: gcc-help
Actually Arturas,
There were already include guards in place. I don't know of anyway
to program without those :)
I don't know what exactly caused the error but it happened under
MSVC7 also. The error message just complete threw me off as I didn't
see the connection.
corey
On 6/13/05, Arturas Moskvinas <arturas.moskvinas@gmail.com> wrote:
> I do not know, you might already know it. Make your header files
> multitiple include "friendly". Simply put some preprocessor
> directives:
>
> #ifndef __file_1_h_
> #define __file_1_h_
> /*your declaration and so on...*/
>
> #endif
>
>
> Arturas Moskvinas
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-13 14:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-11 5:46 Does not name a type corey taylor
2005-06-13 1:31 ` corey taylor
2005-06-13 7:11 ` Arturas Moskvinas
2005-06-13 14:39 ` corey taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).