home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!hela.iti.org!usc!usc!not-for-mail
- From: olaf@alnitak.usc.edu (Olaf Meeuwissen)
- Newsgroups: comp.lang.fortran
- Subject: Multiple includes
- Date: 10 Nov 1992 10:02:18 -0800
- Organization: University of Southern California, Los Angeles, CA
- Lines: 27
- Message-ID: <1dotfaINN4a1@alnitak.usc.edu>
- NNTP-Posting-Host: alnitak.usc.edu
-
- Hello,
-
- I have a question concerning include files. Whenever I include a file twice in
- the same subroutine my compiler complains, understandably. However, I really
- would like to do this. Is there a way to include files conditionally? I mean,
- only include it if it is not included already.
-
- The reason for this is that I want to put all the maximum dimensions for the
- arrays used in the program in one single file, so the user knows where to find
- them if they have to be changed. Let's call this file `dim.h'. Now I have other
- header files, say `lib.h' and `sys.h', that both contain some arrays, so I want
- to include `dim.h'. Then, if I have to include both `lib.h' and `sys.h' in one
- subroutine, yes, the compiler starts complaining! Of course, I get similar re-
- sults if I want to include `dim.h' and any of the other header files.
-
- For the moment I'm circumventing this by commenting out the include for `dim.h'
- in the other header files and explicitly including it in every subroutine, but
- I find this highly inelegant. Does someone have any suggestions on how to pro-
- gram a conditional include? They are more than welcome at olaf@alnitak.usc.edu.
-
- Thanx,
- ____ ___
- / __ \ /\ / __\ Olaf Meeuwissen (e-mail: olaf@alnitak.usc.edu)
- / / / // /____ _/ / Dept. of Chemistry, Univ. of Southern California
- / / / // // __ \ / _/ ------------------------------------------------
- / /_/ // // /_/ / / / Predestination was doomed from the start.
- \____//_/ \_____\ /_/ -- N.N.
-