首页 > 解决方案 > 如何在 macOS Big Sur 上的 Eclipse 12s IDE(科学)中构建 fortran 代码

问题描述

我在我的 MacBook 上下载并安装了 Scientific Eclipse (2020 -12s) 但我的“Hello, World!” 代码不会构建。我怀疑下面的错误意味着找不到我的 GNU FORTRAN (gfortran),但 PATH 变量中有 /usr/local/bin 。谷歌博士没有找到任何解决这个问题的答案。我无法在 Eclipse 文件中找到任何地方来专门添加路径。在终端中调出“sh”并输入“gfortran”会导致“无文件”的预期错误。

% which gfortran
/usr/local/bin/gfortran

代码:

program Hello
    implicit none
    print *, 'Hello, World!'
end program Hello

Eclipse 构建错误:

11:55:48 **** Build of configuration Debug for project Learn ****
make all 
Building file: ../Hello.f90
Invoking: GNU Fortran Compiler
gfortran -funderscoring -O0 -g -Wall -c -fmessage-length=0 -o "Hello.o" "../Hello.f90"
/bin/sh: gfortran: command not found
make: *** [Hello.o] Error 127
"make all" terminated with exit code 2. Build might be incomplete.

标签: eclipsefortrangfortran

解决方案


推荐阅读