Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Avisos
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Preprocess included file

Gerald_Duff
Principiante
1.410 Vistas

Hi,

Is it possible to preprocess included files ? By default, it seems to me that they are not.


Regards,

Gerald

 

0 kudos
8 Respuestas
Steven_L_Intel1
Empleados
1.410 Vistas
If you want include files preprocessed, use #include to include them.
jimdempseyatthecove
Colaborador Distinguido III
1.410 Vistas
I use #include "filename.inc" in my programs with FPP precompilation.

Note....

Your #include file may contain #define's for macros and macro substitution

*** #include macros are "in scope" from the #include through the end of the compilation unit (or until explicitly #undef'd)

The macros (if used) are not scoped to the subroutine/function as are the FORTRAN include files (no #)

Jim Dempsey
Gerald_Duff
Principiante
1.410 Vistas
Thanks for the prompt answer, this solves my issues. It also raises another question : to make "#include" work I had to add the absolute path to the included file in the pre-processor option, whereas "include" was directly looking into the source folder.


In which way the include directories are different between "#include" and "include" ?

Regards
Steven_L_Intel1
Empleados
1.410 Vistas
Gerald, this is a known bug, issue DPD200151471, not yet fixed. Please add the folder containing the include files as an "additional include directory" as a workaround.
jimdempseyatthecove
Colaborador Distinguido III
1.410 Vistas
>>to make "#include" work I had to add the absolute path to the included file in the pre-processor option

??? I am using relative paths ???

Preprocsssor | Additional Include Directories

... (other include directories here
..\..\Source\Modules
...


The path is relative to the folder containing the project file

In the .f90 files I then use

#include "DEF_ALL.INC"

Where the above is one of my FPP include files

Jim Dempsey
Gerald_Duff
Principiante
1.410 Vistas
Thanks, this works indeed. However, it is annoying to have to add an additional include directory each time a file is included (especially when the included file is in the same folder than the source!).

Regards,

Gerald
jimdempseyatthecove
Colaborador Distinguido III
1.410 Vistas
This is a Visual Studio issue. If when creating a project you specify that you do not wish to make seperate folder for project (which is a misnomer since it means folder for "project source files" as opposed to "project file" then you likely will not need to specify the folder where your include files reside. Or conversely you can place your FPP include files in your project folder.

The way I use FORTRAN is to isolate my module files in a seperate folder from the subroutines and functions that use the module. This folder is required to be placed in the include path. I place my FPP include files in this folder.

Jim Dempsey
Anonymous66
Colaborador Valioso I
1.410 Vistas

A fix has been found for this issue. We are currently planning to include it in the next major release which is currently scheduled for later this year.

Annalee

Responder