构建时使用的编译器和编译器选项信息#

compiler_options#

名称#

compiler_options(3) - [编译器:查询] 传递给编译器的选项

概要#

    result = compiler_options()
     character(len=:) function compiler_options()

特性#

  • 返回值是具有系统相关长度的默认种类字符变量。

描述#

compiler_options(3) 返回一个包含用于编译的选项的字符串。

选项#

无。

结果#

结果包含用于编译包含compiler_options(3) 调用的文件的编译器标志。

示例#

示例程序

program demo_compiler_version
use, intrinsic :: iso_fortran_env, only : compiler_version
use, intrinsic :: iso_fortran_env, only : compiler_options
implicit none
   print '(4a)', &
      'This file was compiled by ', &
      compiler_version(),           &
      ' using the options ',        &
      compiler_options()
end program demo_compiler_version

结果

This file was compiled by GCC version 10.3.0 using
the options -I build/gfortran_2A42023B310FA28D
-mtune=generic -march=x86-64 -auxbase-strip
build/gfortran_2A42023B310FA28D/compiler_options/app_main.f90.o
-g -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1
-fcheck=bounds -fcheck=array-temps -fbacktrace
-fcoarray=single -J build/gfortran_2A42023B310FA28D
-fpre-include=/usr/include/finclude/math-vector-fortran.h

This file was compiled by nvfortran 21.5-0 LLVM
using the options app/main.f90 -c -Minform=inform
-Mbackslash -Mbounds -Mchkptr -Mchkstk -traceback -module
build/nvfortran_78229DCE997517A4 -Ibuild/nvfortran_78229DCE997517A4 -o
build/nvfortran_78229DCE997517A4/compiler_options/app_main.f90.o

This file was compiled by Intel(R) Fortran Intel(R) 64 Compiler Classic
for applications running on Intel(R) 64, Version 2021.3.0 Build
20210609_000000 using the options -Ibuild/ifort_5C58216731706F11
-c -warn all -check all -error-limit 1 -O0 -g -assume
byterecl -traceback -module build/ifort_5C58216731706F11 -o
build/ifort_5C58216731706F11/compiler_options/app_main.f90.o

标准#

Fortran 2008

另请参阅#

compiler_version(3)iso_fortran_env(7)

fortran-lang 内在函数描述 (许可证:MIT) @urbanjost

compiler_version#

名称#

compiler_version(3) - [编译器:查询] 编译器版本字符串

概要#

    result = compiler_version()
     character(len=:) function compiler_version()

特性#

  • 返回值是具有系统相关长度的默认种类标量字符

描述#

compiler_version(3) 返回一个包含编译器名称和版本的字符串。

选项#

无。

结果#

返回值包含用于编译包含compiler_version(3) 调用的文件的编译器名称及其版本号。

示例#

示例程序

program demo_compiler_version
use, intrinsic :: iso_fortran_env, only : compiler_version
implicit none
   print '(2a)', &
      'This file was compiled by ', &
      compiler_version()
end program demo_compiler_version

结果

This file was compiled by GCC version 10.3.0

This file was compiled by Intel(R) Fortran Intel(R) 64 Compiler
Classic for applications running on Intel(R) 64, Version 2021.3.0 Build
20210609_000000

This file was compiled by nvfortran 21.5-0 LLVM

标准#

Fortran 2008

另请参阅#

compiler_options(3)iso_fortran_env(7)

fortran-lang 内在函数描述 (许可证:MIT) @urbanjost