Wednesday, June 8, 2011

在使用Visual Studio+Intel Fortran编译器时遇到编译老程序的问题

最近需要编译一个老程序,在程序的说明中提示:
NOTE: All FORTRAN code needs to be compiled with the option to retain the values of local subroutine variables.
This is usually not a default option in modern compilers. Without this compile option, the code will not work
properly.

然后上网搜了一下,也发现了类似问题的说明,但是解决方案并没有说的很明确:
This is different from the behavior of many FORTRAN 77 compilers, some of which retained the values of all local variables, even though this wasn't required by the language standard. Some old programs were written relying on this non-standard behavior -- these programs will fail on the newer compilers. Many compilers have an option to use the non-standard behavior and "save" all local variables.

经过尝试,最后找到了解决方法:
右键点击工程--属性--Fortran--Data--Local Variable Storage--选择“All Variable SAVE”
这样就可以达到上面说的目的,运行老的FORTRAN 77的程序了。

No comments:

Post a Comment