最小的Fortran文件,可以编译任何编译器

时间:2013-08-23 20:08:14

标签: cmake fortran

CMake开发人员recommend adding a dummy Fortran file告诉CMake静态库需要与Fortran库链接(例如,将C程序与LAPACK链接时)。

我的第一个想法是使用空dummy.f。但是ifort 9.0 won't compile it

什么是最小的便携式虚拟Fortran文件?

旧的英特尔编译器是唯一一个有空文件问题的编译器吗?

1 个答案:

答案 0 :(得分:3)

与GFortran和Absoft Fortran相同的错误。实际上,您需要一个“程序”块来构建可执行文件。 这个dummy.f可以工作:

      program dummy
      end

根据标准,“Fortran程序必须包含一个主程序,并且可以包含任意数量的其他类型的程序单元”。 (参见Adams等人的“Fortran 95手册”,第2.1.1节第19页)

standard Fortran 95同一节2.2.1,第12页:

A program consists of exactly one main program unit and any number
(including zero) of other kinds of program units. The set of program
units may include any combination of the different kinds of program
units in any order as long as there is only one main program unit.