在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版本和个人需求而略有不同。在安装过程中,请仔细阅读并理解每个步骤的说明。