當前位置: 首頁>>技術教程>>正文


apt – 如何安裝 Fortran 77 編譯器?

, , ,

問題描述

我剛剛在我的筆記本電腦上安裝了 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

參考資料

本文由Ubuntu問答整理, 博文地址: https://ubuntuqa.com/zh-tw/article/12923.html,未經允許,請勿轉載。