Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Q about INCLUDE file placement

WSinc
New Contributor I
515 Views
If I have two files that use the same COMMON block, but are in two different folders,
where do I put the INCLUDE file? (ex: INCLUDE "commonblock.inc" )

If I put it in folder A then the ones in folder B can't reference the INCLUDE text, likewise
if I put it in folder B, the ones in folder A can't see it when I compile them.

So is there some trick whereALL the routines can reference the same INCLUDE text file?
Does it belong in HEADERS or RESOURCES? If not there, then where?

I assume that the routines are in different project, but share a solution space.

Is there an article about this anywhere?
0 Kudos
2 Replies
netphilou31
New Contributor III
515 Views
Hi,

I think that you have two possibilities:

1. Declare the include file using an absolute reference (full path to the file).
2. Move the common block declarations into a module by removing the common statement and adding the
module file into your project.

Phil.
0 Kudos
John_B__Walter
Beginner
515 Views
Quoting netphilou31
Hi,

I think that you have two possibilities:

1. Declare the include file using an absolute reference (full path to the file).
2. Move the common block declarations into a module by removing the common statement and adding the
module file into your project.

Phil.

There is presumably some "natural" folder where your include file belongs, probably one or the other of the folders you mentioned, but perhaps some third folder.

Now, for the other file or project, go to the fortran properties.
The second entry for "General" (that's Fortran \ General) you'll see "Additional Include Directories"
Add any directories where includes may be found (such as for the other project) besides the directory for this project. This way you don't need to put the full path in each file that uses the include, only here in the project properties.
0 Kudos
Reply