2013-08-23 45 views

回答

3

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

 program dummy 
     end 

按照标准,“Fortran程序中必须包含一个主程序可以包含任意数量的其他类型的程序执行单位”。 (请参见 “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. 
+0

谢谢,但我不t需要*主程序单元*,只有一个虚拟文件(翻译单元)将被编译并与不同语言的真实程序链接。 GFortran接受空文件:'touch dummy.F; gfortran -c dummy.F' – marcin

+5

在这种情况下,用子程序替换程序。 – cup

+0

@marcin。实际上,标准定义了程序单元(函数,子程序,程序)。它不知道什么是“程序文件”,它只知道程序单元。因此,一个空文件根本没有定义。但是,您是否仍然可以从空的源文件构建空的对象文件并不是非常清楚 - 我不确定它与Fortran有什么关系。但是你仍然可以依靠上面的代码,用cup指出的*子程序替换*程序*。 – 2013-08-26 12:14:50