在CentOS系統上配置Fortran環境可以通過以下幾種方法實現:
sudo yum update -y
sudo yum groupinstall "Development Tools" -y
gfortran --version
wget http://registrationcenter-download.intel.com/akdlm/irc_nas/2568/l_fcompxe_intel64_2011.10.319.tgz
tar -zxvf l_fcompxe_intel64_2011.10.319.tgz
cd l_fcompxe_intel64_2011.10.319
./install.sh
按照提示完成安裝過程。
echo 'export PATH=/opt/intel/composerxe/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/opt/intel/composerxe/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
安裝Eclipse IDE(如果尚未安裝)。
安裝CDT插件:
Help
-> Install New Software...
。Add
按鈕。Name
字段中輸入 Fortran Development Tools
,在 Location
字段中輸入 http://download.eclipse.org/tools/cdt/releases/latest
。OK
。Fortran Development Tools
,然后點擊 Next
,按照提示完成安裝過程。創建并配置Fortran項目:
File
-> New
-> Project...
,然后選擇 Fortran Project
。Finish
。Properties
,然后選擇 C/C Build Settings
。Tool Settings
選項卡中,展開 Fortran
,然后選擇 GNU Fortran Compiler
。Command to get compiler specs
文本框中,輸入 gfortran --version
,然后點擊 Apply and Close
。編譯并運行Fortran程序:
Build Project
。Run As
-> Fortran Application
。請注意,具體步驟可能會因CentOS版本和個人需求而略有不同。在安裝過程中,請仔細閱讀并理解每個步驟的說明。