POV-Ray : Newsgroups : povray.general : Include files that need other include files : Include files that need other include files Server Time
11 Aug 2024 01:15:48 EDT (-0400)
  Include files that need other include files  
From: Nieminen Juha
Date: 24 Sep 1999 04:25:22
Message: <37eb3572@news.povray.org>
In C (and thus C++) when you need a function/class/whatever, you #include
the header file defining it. It's always enough to #include just that one
header file that defines it. You don't have to include any other header
files in order to be able to use the one you want.
  If this header file needs other header file (as very often is the case),
it #includes them itself. The problems of repeated definitions (ie. the
same file is #included more than once), which is often illegal (for example,
you can't declare the same class twice) or at least slows parsing, is
avoided with the typical method:
#ifndef _STUFF_H_
#define _STUFF_H_
  (some stuff here)
#endif

  For some strange reason, which I can't understand, the standard include
files of povray do not do this.
  For example, if you #include "textures.inc" you get an error. The reason
is that you didn't #include "colors.inc" before.
  That doesn't make sense. If "textures.inc" needs "colors.inc", why doesn't
it #include "colors.inc" by itself?
  If I #include "textures.inc" I expect it to work as is.

  I have added the #include "colors.inc" at the beginning of "textures.inc",
and no problems, of course. Now I can just #include "textures.inc" and it
works, as it should.
  Why the official version is illogical in this way is beyond me.

  So this is a request for the next version of povray.
  If an include file needs another include file, then add the #include in
the first.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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