在Ubuntu中管理Fortran項目,可參考以下方法:
sudo apt update
和sudo apt install gfortran
,安裝后可通過gfortran --version
驗證。gfortran -o output_file source_file.f90
;也可將多個相關文件放在同一目錄,編譯主程序文件,如gfortran -o output_file main.f90 module_file.f90
,或在主程序中使用use
語句引入模塊。~/.bashrc
中,然后使用fpm new
創建項目,fpm run
運行項目。/usr/lib
或/usr/local/lib
目錄,可用find
命令查找,編譯時用-L
指定庫路徑,-l
指定庫名。~/.bashrc
中添加export PATH=/path/to/gfortran/bin:$PATH
,然后運行source ~/.bashrc
。git init
、git add
、git commit
等命令管理代碼版本。