本文介绍了在Fortran主文件头中包含.f和.F90文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在F90程序中使用了一些F77固定格式代码。我试图在我的主程序中包含这两种代码。以下是我如何安排我的代码:

I am using some F77 fixed format code with my F90 program. I am trying to include both kinds of code in my main program. Here's how I have arranged my code:

头文件:

Header files:

File Name:include.inc
include 'module_variables.F90'
include 'message.F90'
include 'module_common_functions.f90'
include 'module_input_gdf.F90'
...

相关的LAPACK文件

Relavant LAPACK files

File Name: lapack.inc
include 'xerbla.f'
include 'strsm.f'
include 'slaswp.f'
include 'sgetrs.f'
include 'sgetrf.f'
...

现在我的主程序如下所示:

Now my main program looks like:

include 'lapack.inc'
include 'include.inc'

program MDL_HydroD

   use module_variables
   use module_write_files
   use module_read_files
   ...

当我尝试使用 ifortMDL HydroD.F90编译主代码时,F77格式的文件给出错误信息:

When I try to compile my main code with ifort "MDL HydroD.F90", the F77 formatted files give error message:

xerbla.f(1): error #5078: Unrecognized token '\' skipped
*> \brief \b XERBLA
---^

这是因为编译器是阅读评论部分(以*开头)。有什么方法可以在我的头文件中使用这两种Fortran代码进行编译。

This is because the compiler is reading the commented section (starts with *). Is there any way I can compile with both type of fortran code in my header.

注意:我正在使用英特尔®Composer XE 2013和命令提示符。

Note: I am using Intel Composer XE 2013 with command prompt.

推荐答案

将相关指令放在包含文件之前,然后将其他指令放在包含文件后面以切换源表单。也许:

Place the relevant directive before the include file, and then place the other directive after the include file to switch the source form back. Perhaps:

!DEC$ NOFREEFORM
      INCLUDE 'lapack.inc'
!DEC$ FREEFORM

请参阅获取更多信息。

这篇关于在Fortran主文件头中包含.f和.F90文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 11:17