Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
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.

Finding include files

vriesdwj
Beginner
1,229 Views

In my project sources are spread over many different directories. In all these directories there are includefiles that are used by the sources in that same directory.
According to the HELP-manual includefiles that reside in the same directory as the sources should be found directly.
Searching for Include and .mod Files
Directories are searched for include files in this order:
1. Directory of the source file that contains the include.

Well, it does not.

The default Include and Use Path is set to "Source File Directory"

Can you please help me solving this problem.

0 Kudos
8 Replies
Jugoslav_Dujic
Valued Contributor II
1,229 Views
Project-specific:
Configuration properties/Fortran/Preprocessor/Additional include directories

(preferrably use paths relative to the .vfproj file, e.g. ../OtherProject/Include )

Permanent (for all current and future projects):
Tools/Options/Intel Fortran/Includes
(must use full paths here)
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,229 Views
Sorry, I misread your post -- I thought you were asking how to include files from different directories.
0 Kudos
Steven_L_Intel1
Employee
1,229 Views
It's supposed to work as documented. Please submit a problem report to Intel Premier Support and attach a ZIP of your project including all folders with source files.
0 Kudos
vriesdwj
Beginner
1,229 Views
Hi Steve thanks for your answer and sorry for not being complete in my problem description.
Includefiles are found in de "Source File Directory" (as should be) if I specify them directly in my sourcecode.
But in my sourcecode the includefiles should be found in a part of the code with preprocessor lines eg:
subroutine Sub2
implicit none
include "incl2.fi"
#ifdef UNIX
# include "incl3.fi"
#else
# include "incl4.fi"
#endif
print *, 'Hello World from Sub2'
end subroutine Sub2
The compiler can find incl2.fi but it can't find incl4.fi.
incl2.fi and incl3.fi reside both in the same directory as the sourcecode.

Preprocessor: Yes
Default Include and Use path: Source File Directory

I hope you can help,
Kind regards,
Wilco de Vries.

>In my project sources are spread over many different directories. In all these directories >there are includefiles that are used by the sources in that same directory.
>According to the HELP-manual includefiles that reside in the same directory as the >sources should be found directly.
>Searching for Include and .mod Files
>Directories are searched for include files in this order:
>1. Directory of the source file that contains the include.
>Well, it does not.
>The default Include and Use Path is set to "Source File Directory"
>Can you please help me solving this problem.
0 Kudos
vriesdwj
Beginner
1,229 Views
Hi Steve thanks for your answer and sorry for not being complete in my problem description.
Includefiles are found in de "Source File Directory" (as should be) if I specify them directly in my sourcecode.
But in my sourcecode the includefiles should be found in a part of the code with preprocessor lines eg:
subroutine Sub2
implicit none
include "incl2.fi"
#ifdef UNIX
# include "incl3.fi"
#else
# include "incl4.fi"
#endif
print *, 'Hello World from Sub2'
end subroutine Sub2
The compiler can find incl2.fi but it can't find incl4.fi.
incl2.fi, incl3.fi and incl4.fi reside all in the same directory as the sourcecode.

Preprocessor: Yes
Default Include and Use path: Source File Directory

I hope you can help,
Kind regards,
Wilco de Vries.

>In my project sources are spread over many different directories. In all these directories >there are includefiles that are used by the sources in that same directory.
>According to the HELP-manual includefiles that reside in the same directory as the >sources should be found directly.
>Searching for Include and .mod Files
>Directories are searched for include files in this order:
>1. Directory of the source file that contains the include.
>Well, it does not.
>The default Include and Use Path is set to "Source File Directory"
>Can you please help me solving this problem.
0 Kudos
Steven_L_Intel1
Employee
1,229 Views
Oh, you're using #include. That I think has fdifferent rules.

Try using the standard Fortran INCLUDE statement.
0 Kudos
TimP
Honored Contributor III
1,229 Views
cpp/fpp style #include requires setting an appropriate -Qfpp option.
0 Kudos
vriesdwj
Beginner
1,229 Views
Hi,
I removed the # at the beginning of the lines with include and now it all seems to work.
Thanks for all.
Regards,
Wilco de Vries.
0 Kudos
Reply