问题描述
我刚刚在我的笔记本电脑上安装了 12.04 LTS,我对此有点陌生。我需要用 Fortran 77 编写一些程序,我需要一个 Fortran 77 编译器。我已尝试按照 Ubuntu 网站中的说明安装 g77,但无法这样做。我在终端中输入了以下内容:
sudo apt-get install g77
并获得以下信息:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package g77 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'g77' has no installation candidate
我可以知道是什么问题吗?我曾尝试在软件中心搜索 g77,但显然它不存在。这是否意味着它不适用于 12.04?
我目前正在使用配备英特尔酷睿 i5-2450M 处理器的华硕 K43S 笔记本电脑,并且我的 Ubuntu 与 Windows 一起安装。
最佳方案
存储库中有 GNU Fortran 95 编译器,可以使用安装
sudo apt-get install gfortran
\\n
This is the GNU Fortran 95 compiler, which compiles Fortran 95 on\\n platforms supported by the gcc compiler. It uses the gcc backend to\\n generate optimized code.
\\n
如果您特别需要 Fortran 77 的前沿特性,那么 f2c
程序显然可以将 Fortran 77 转换为 C。
\\n
f2c translates FORTRAN 77 (with some extensions) into C so that it\\n can then be compiled and run on a system with no Fortran compiler. \\n The C files must then be linked against the appropriate libraries.
\\n
This is an actively maintained FORTRAN to C translator and with the\\n fort77 frontend provides an ideal way to compile FORTRAN routines as\\n black boxes (for example for invocation from C). Source level\\n debugging facilities are not available, and error messages are not as\\n well developed as in g77.
\\n
我不确定 g77
编译器发生了什么——显然,它存在于旧版本的 Ubuntu 中,但现在不再存在,至少不在标准存储库中。
次佳方案
输入您的终端;
-
Fortran 95 编译器:
\n
sudo apt-get install gfortran\n
-
对于 Fortran 77 编译器:
\n
sudo apt-get install fort77\n