【问题标题】:Fortran error #5082: Syntax error, found IDENTIFIER when expecting one of: <END-OF-STATEMENT> ;Fortran 错误 #5082:语法错误,在期望以下之一时找到 IDENTIFIER: <END-OF-STATEMENT> ;
【发布时间】:2018-04-14 22:50:05
【问题描述】:

我正在“制作”一个代码。

使用make 编译失败并产生此错误

mpif90 -mkl -O3 -no-prec-div -fpp -openmp -xHost -DMPI -DEFTCOSMOMC -module ReleaseEFTMPI -IReleaseEFTMPI/ -c equations_EFT.f90 -o ReleaseEFTMPI/equations_EFT.o
equations_EFT.f90(267): error #5082: Syntax error, found IDENTIFIER 'EFTCAMBINITIALCONDITIONS' when expecting one of: <END-OF-STATEMENT> ;
        module subroutine EFTCAMBInitialConditions( y, EV, tau )
--------------------------^
equations_EFT.f90(267): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % [ . = =>
        module subroutine EFTCAMBInitialConditions( y, EV, tau )
----------------------------------------------------------------^
equations_EFT.f90(271): error #6786: This is an invalid statement; an END [MODULE] statement is required.
        end subroutine EFTCAMBInitialConditions
--------^
equations_EFT.f90(271): error #6758: This name is invalid; if a name is present, it must match the corresponding interface body name.   [EFTCAMBINITIALCONDITIONS]
        end subroutine EFTCAMBInitialConditions
-----------------------^
equations_EFT.f90(268): error #6457: This derived type name has not been declared.   [EVOLUTIONVARS]
            type(EvolutionVars) EV
-----------------^
equations_EFT.f90(269): error #6683: A kind type parameter must be a compile-time constant.   [DL]
            real(dl) :: y(EV%nvar)
-----------------^
equations_EFT.f90(269): error #6535: This variable or component must be of a derived or structure type   [EV]
            real(dl) :: y(EV%nvar)
--------------------------^
equations_EFT.f90(269): error #6460: This is not a field name that is defined in the encompassing structure.   [NVAR]
            real(dl) :: y(EV%nvar)
-----------------------------^
equations_EFT.f90(269): error #6223: A specification expression is invalid.   [NVAR]
            real(dl) :: y(EV%nvar)
-----------------------------^
equations_EFT.f90(270): error #6683: A kind type parameter must be a compile-time constant.   [DL]
            real(dl) :: tau
-----------------^
equations_EFT.f90(269): error #6279: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association   [EV]
            real(dl) :: y(EV%nvar)
--------------------------^
compilation aborted for equations_EFT.f90 (code 1)

我附上来自equations_EFT.f90的sn-p

interface

        module subroutine EFTCAMBInitialConditions( y, EV, tau )
            type(EvolutionVars) EV
            real(dl) :: y(EV%nvar)
            real(dl) :: tau
        end subroutine EFTCAMBInitialConditions

    end interface

这个sn-p有什么问题吗?这很奇怪,因为这是分布式软件,但我只是按照说明编写代码。

【问题讨论】:

    标签: makefile fortran


    【解决方案1】:

    问题的代码是使用submodules 的示例,这是2008 年修订版中新引入的Fortran 功能。要编译此代码,您需要一个理解此概念的编译器。

    GNU 和 Intel 编译器就是这样的例子,但您需要一个合适的版本。

    【讨论】:

    • 谢谢。我的 gcc 版本是 6.3.0,我认为这足以支持您提到的功能。你知道更可靠的版本吗?
    • gfortran 的第 6 版应该足够了,但我从编译标志和错误消息的形式猜测您的 mpif90 实际上正在将编译传递给 ifort。我认为需要 ifort 16+(也许 17)。您可以使用mpif90 -show 或类似的方式检查编译。
    • 确实,mpif90 指向 ifortran 和一个版本,即工具,即 ifort 版本 14.0.2。无法更新ifortran的版本,如何强制mpif90指向gfortran?
    • 希望 Makefile(或任何构建系统创建该文件)中应该有一些东西可以让您更改底层编译器。您可以将 mpif90 更改为使用 gfortran(通常会有类似 -compiler 的标志),但您需要将 ifort 标志转换为 gfortran 标志等。
    • 您可能还需要为 gortran 重新编译 mpi 库。询问您的系统管理员是否有用于 gfortran 的 mpi。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多