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

Intel Fortran Compilation Error

Muyan__Can
Beginner
1,529 Views

To whom it may concern,

As I am using the following intel directive in usermat.f90 file:

!DIR$ include impcomEjb.inc

I get the following error message in compile.log file:

 

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.1.156 Build 20171018

Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

 

usermat.f90

usermat.f90(148): remark #5082: Directive ignored - Syntax error, found CHARACTER_CONSTANT 'impcomEjb.inc' when expecting one of: :

!DIR$ include "impcomEjb.inc"

--------------^

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.1.156 Build 20171018

Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

My files are attached to my message.

Could you please help to troubleshoot this error message?

Thank you for your time and kind concern.

 

 

 

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,529 Views

Intel Fortran has never supported an INCLUDE compiler directive. As Andrew suggests there's no point to one since Fortran has the standard INCLUDE statement. (There's also #include as a preprocessor directive.)

View solution in original post

0 Kudos
8 Replies
andrew_4619
Honored Contributor II
1,529 Views

Plain old:

include "impcom.inc" 

should work if this inc file is in the same folder as the source file. I thought it strange there was a directive !DIR$ include. I can't find that in the help system, but maybe I did not look hard enough..

 

0 Kudos
Steve_Lionel
Honored Contributor III
1,530 Views

Intel Fortran has never supported an INCLUDE compiler directive. As Andrew suggests there's no point to one since Fortran has the standard INCLUDE statement. (There's also #include as a preprocessor directive.)

0 Kudos
Muyan__Can
Beginner
1,529 Views

Dear Steve Lionel and Andrew,

Thank you very much for your informative replies to my questions. I was able to run my code with the following command in my usermat.f90 file:

#include "imcompEjb.inc"

However I would like to do the following:

Since I am writing my FORTRAN Code in FREE format (*.f90), I use the compiler  switch /free, which then thinks my code is in FREE format.  Then, I want to switch back to FIXED (F77) format. In order to switch to FIXED I use the following compiler directive:

!DIR$ FIXED

But I get the following error message:

*******************************************************************************************************

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.1.156 Build 20171018
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

usermat.f90
.\impcomEjb.inc(7): remark #5140: Unrecognized directive
!DIR$ FIXED

*******************************************************************************************************

I have attached the files to my E-Mail. Could you please help me to troubleshoot this problem?

Thank you for your time and kind concern.

Best Regards,

Can Muyan

-- 
PhD Student, Dept. of Aerospace Engineering
METUWIND - METU Center for Wind Energy
Middle East Technical University
06800 Ankara
TURKEY


Web: https://ruzgem.metu.edu.tr/en/

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,529 Views

The directives are

!DIR$ FREEFORM
!DIR$ NOFREEFORM

Jim Dempsey

0 Kudos
JVanB
Valued Contributor II
1,529 Views

Actually the right syntax (IMHO) is for the INCLUDE file to start with

!DIR$ PUSHFORM

!DIR$ NOFREEFORM

and end with

!DIR$ POPFORM

But these directives aren't as yet supported by ifort.

0 Kudos
gib
New Contributor II
1,529 Views

Google is your friend.  A search for "Fortran directives" found:

https://software.intel.com/en-us/node/692388

0 Kudos
Muyan__Can
Beginner
1,529 Views

Dear Jim Dempsey, Repeat Offender and gib,

Thank you very much for your valuable comments. I was able to correct the mistake in my compile directive by using the following command:

!DIR$ NOFREEFORM

I appreciate your support!

Best Regards,

Can Muyan

-- 
PhD Student, Dept. of Aerospace Engineering
METUWIND - METU Center for Wind Energy
Middle East Technical University
06800 Ankara
TURKEY


Web: https://ruzgem.metu.edu.tr/en/
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,529 Views

Muyan,

There is a difference between the Fortran PreProcessor (FPP) #include
And the Fortran include (no #)

The FPP #include inserts the text in context of the entire compilation unit, whereas the Fortran include text is scoped to the entity in which it is placed (subroutine, function, module, COMMON, ...). The two are not entirely equivalent. When the FPP is not required, use the Fortran INCLUDE.

Jim Dempsey

0 Kudos
Reply