- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is it possible to preprocess included files ? By default, it seems to me that they are not.
Regards,
Gerald
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want include files preprocessed, use #include to include them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
In which way the include directories are different between "#include" and "include" ?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>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
??? 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Regards,
Gerald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page