使用 gfortran 优于 gcc 的优势

Advantage to use gfortran over gcc

https://repl.it/ 中探索 bash 配置文件,他们的安装包括 gcc 以及 gfortran

gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
[...]
gfortran --version
GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
[...]

我用两者中的任何一个编译出符合 Fortran95 的代码都没有困难。然而,由于 gfortrangcc (reference) 的一部分,使用专家 (gfortran) 或集合 (gcc) 的功能优势在哪里)?

这记录在 GNU Fortran manual:

A gfortran driver program is also provided, which is identical to gcc except that it automatically links the Fortran runtime libraries into the compiled program.

如果您的程序不依赖于 Fortran 运行 时间库,那么您可以 link 使用 gcc 成功地完成它。这种情况类似于 C++ 和 g++,除了 C++ 运行-时间库依赖性可能更常见。