POV-Ray : Newsgroups : povray.programming : C++ problem : Re: C++ problem Server Time
28 Jul 2024 14:26:01 EDT (-0400)
  Re: C++ problem  
From: Johannes Bretscher
Date: 28 Jul 2001 10:43:32
Message: <45juj9.519.ln@cthulhu.hans.5sl.org>
On Sat, 28 Jul 2001 17:20:21 +0300, Peter Popov wrote:
> I am crossposting this to .programming and .unix because I don't
> really know the source of the problem - my incompetence with C++ or my
> compiler (gcc).
>

The compiler works as expected.
 
> This isn't really POV-related ATM but will be at some point in time.
> Anyway...
> 
> [ snip cross inclusion]
> 
> The compiler complains that in ctransf.hh, CVector was not declared in
> this scope. More precisely, it complains about a parse error before &.
> How come? I do include cvector.hh, I do have the proper pre-processor
> directives to avoid multiple inclusion...

The compiler always will read one header first. But this header
already needs the other one.

> 
> I was able to build the project by substituting the includes with
> dummy class declarations like 'class CVector;' in ctransf.hh and
> 'class CTransform;'

One of them is enough, if you know wich is read first.

 in cvector.hh, but I am 100% sure this will lead
> to terrible memory problems during runtime, even though it linked
> properly. Right?

No. First, you only use references, wich are in fact some sort of
pointers. Then in the first step the compiler needs only to know
which names are defined. The exact memory calculation is done later.
(If you are interestet in the exact point read the gcc info files)

> 
> Please help me before I lose all my hair over this problem.
> 
> 

HTH
  Johannes

-- 
E-Mail: bre### [at] 5slorg     www: http://www.5sl.org/~bretscher
pgp fingerprint = 441A 3B97 811D EC61 DC0A  474B 17C4 EB7F 9BD1 BEAC

God, Root, what is difference?
   Illiad


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.