GFortran - 安装测试

检查系统有无 gfortran

1
which gfortran

若返回 gfortran not found ,则进行下一步

安装 gfortran

1
sudo apt-get install gfortran

测试 gfortran

查看版本号

1
gfortran --version

测试脚本

1
2
touch hello.f90
vim hello.f90
1
2
3
4
program hello
! This is a comment line; it is ignored by the compiler
print *, 'Hello, World!'
end program hello

编译-链接-运行

1
2
gfortran hello.f90 -o hello
./hello

参考

Fortran 官网:https://fortran-lang.org/en/learn/os_setup/install_gfortran/