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

preprocessor include path differences

henry_b_
Beginner
4,561 Views

I'm trying to compile code I have written, using both ifort and gfortran. The problem I am having is relating to my use of the preprocessor and directory structure.

In my fortran source I have something like:

#include "includes/myinclude1.inc"

In  "includes/myinclude1.inc" I want to include another file, say "includes/sub/myinclude2.inc".

In ifort the preprocessor uses the directory relative to the source directory, so in "includes/myinclude1.inc" I may just do:

#include "includes/sub/myinclude2.inc"

However, in gfortran it is relative to the location of the current include file, so I instead must do:

#include "sub/myinclude2.inc"

Is there a compiler option (either in ifort or gfortran) that will allow me to get the same behavior across compilers?

Thanks.

0 Kudos
21 Replies
Steven_L_Intel1
Employee
487 Views

It's not yet fixed, but is being worked on. explicitly specifying -source-include is a workaround.

0 Kudos
Reply