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

compile macro with ifort

diedro
Beginner
466 Views
hi everyone,
I have a fortran source code with some macro:
test.f90
test.inc
test_dlist_int.f90
diagnostic.inc
I could compile them?
I tryed with:
ifort *.f90 #include "testing.inc"
but it does not work
thank you very much
0 Kudos
2 Replies
Kevin_D_Intel
Employee
466 Views

You can expand the include files (.inc) into your .f90 source files using #include (with -fpp) or the Fortran INCLUDE statement.

For example, your test.f90 might contain:

program sample
INCLUDE test.inc
--or--
#include "test.inc"


end

And perhaps test_dist_int.f90 might contain:

subroutine test_dist_int()
INCLUDE diagnostic.inc
-- or --
#include "diagnostic.inc"


return
end

To compile when using the INCLUDE form, use: ifort test_dist_int.f90 main.f90

To compile when using the #include form, use: ifort -fpp test_dist_int.f90 main.f90

If any of the .inc or .f90 source files include macros requiring preprocessing, then you can use either the INCLUDE or #include form shown above but you must add the -fpp compiler option to expand the macros.

Hope that helps.

0 Kudos
diedro
Beginner
466 Views
hi,
thank you very much
It seems to work, however I have same debug problem. I think that it is my fault.
I have ti read carefullly the code.
best Regards
0 Kudos
Reply