Linux command
gfortran 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile Fortran file
gfortran [source.f90] -o [output]
Compile with optimization
gfortran -O3 [source.f90] -o [output]
Enable warnings
gfortran -Wall [source.f90] -o [output]
Debug build
gfortran -g [source.f90] -o [output]
Link math library
gfortran [source.f90] -o [output] -lm
说明
gfortran is the GNU Fortran compiler, part of GCC. It compiles Fortran 77, 90, 95, 2003, and 2008 standards to native executables. The compiler provides extensive optimization, debugging support, and interoperability with C code. It benefits from GCC's mature infrastructure. gfortran is the standard open source Fortran compiler for scientific computing.
参数
- -o _FILE_
- Output filename.
- -c
- Compile only, no linking.
- -g
- Generate debug info.
- -O _LEVEL_
- Optimization level (0-3).
- -Wall
- Enable warnings.
- -l _LIBRARY_
- Link library.
- --help
- Display help information.
FAQ
What is the gfortran command used for?
gfortran is the GNU Fortran compiler, part of GCC. It compiles Fortran 77, 90, 95, 2003, and 2008 standards to native executables. The compiler provides extensive optimization, debugging support, and interoperability with C code. It benefits from GCC's mature infrastructure. gfortran is the standard open source Fortran compiler for scientific computing.
How do I run a basic gfortran example?
Run `gfortran [source.f90] -o [output]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _FILE_ do in gfortran?
Output filename.