在 Ubuntu 上学习 Fortran,可以从系统安装、入门教程、书籍、在线资源几个方向入手。下面按“从零开始”的方式给你整理一份实用清单。
一、在 Ubuntu 上安装 Fortran 编译器
最常用的 Fortran 编译器是 gfortran(GNU 编译器)。
sudo apt update
sudo apt install gfortran
验证是否安装成功:
gfortran --version
二、官方 / 权威文档(强烈推荐)
1. GCC 官方 gfortran 文档
- 网址:https://gcc.gnu.org/onlinedocs/gfortran/
- 内容:语法、编译选项、标准支持
- 适合:查语法、查报错
2. Fortran 标准文档(进阶)
- Fortran 2008 / 2018 标准
- 搜索:Fortran 2018 standard PDF
三、中文 Fortran 教程(适合入门)
1. 菜鸟教程(有 Fortran 基础)
- https://www.runoob.com/fortran/fortran-tutorial.html
- 内容:基础语法、示例
- 优点:中文、易懂
2. 清华大学 / 中科院相关课程
搜索关键词:
site:edu.cn Fortran 教程 Ubuntu
常见内容:
- 科学计算 Fortran 课程
- 数值分析 Fortran 作业
四、英文经典免费教程(质量高)
1. Fortran Tutorial (TutorialsPoint)
- https://www.tutorialspoint.com/fortran/
- 内容:从 Hello World 到数组、函数
2. Fortran90.org
- https://fortran90.org/
- 内容:现代 Fortran(90/95/2003)
- 适合:写“现代风格”代码
3. MIT / 大学公开课
搜索:
Fortran course site:mit.edu
五、推荐书籍(可找电子版)
- 《Fortran 95/2003 程序设计》(中文,经典)
- Modern Fortran Explained(英文,权威)
- Fortran for Scientists and Engineers(Stephen Chapman)
六、Ubuntu 下写一个简单例子
文件:hello.f90
program hello
print *, "Hello, Ubuntu Fortran!"
end program hello
编译运行:
gfortran hello.f90 -o hello
./hello
七、社区与问答(遇到问题用)
- Stack Overflow(搜
fortran ubuntu)
- 知乎 / CSDN(中文问题多)
- Reddit:r/fortran
如果你愿意,我可以:
- 给你一套 Ubuntu + Fortran 入门 7 天计划
- 或针对 科学计算 / 数值模拟 给你专项教程
- 或帮你配置 VSCode + Fortran 开发环境
你主要用 Fortran 做什么?