visual-studio-code - 无法使用 task.json 在 macOS Catalina 的 vscode 中编译 fortran 90 代码
问题描述
我正在尝试在 macOS Catalina 的 vscode 中使用 gfortran 编译器编译 fortran 90 代码。当我gfortran -o ./main Hello.f90
在 vscode 终端中使用命令时,它可以工作。但是,如果我尝试添加 task.json 并尝试“运行任务”,则会引发错误。gfortran: fatal error: cannot execute 'f951': execvp: No such file or directory compilation terminated.
我已经尝试了几件事,包括find/usr/local/ -name f951
此链接中的一件gfortran: error trying to exec 'f951': execvp: No such file or directory,但没有运气。请帮忙。
我的任务.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "gfortran",
"args": [
"-o",
"./main",
"Hello.f90"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
解决方案
这是我的 task.json 看看它是否对你有帮助。注意注释行“.exe”。也许您可以在那里粘贴 macOS 的相关扩展。
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"_runner": "terminal",
"tasks": [
{
"label": "build_gfortran",
"type": "shell",
"windows": {
"command": "gfortran"
},
"linux": {
"command": "gfortran"
},
"osx": {
"command": "gfortran"
},
"args": [
"${file}",
"-g",
"-o",
// "${workspaceRoot}\\${fileBasenameNoExtension}.exe"
"${fileBasenameNoExtension}"
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
顺便说一句,第一次在这里发帖。干杯。
推荐阅读
- jenkins - Sonarqube 扫描获取整个代码或仅获取哈希值
- javascript - Ion.RangeSlider。解析值的问题
- r - R Unite 函数在 Shiny 与代码中的行为不同
- kubernetes - Istio/Envoy 边缘代理 EnvoyFilter (1.9.0)
- python - 通过复制数组中的每个项目来创建新的 numpy 数组
- ffmpeg - 使用 ffmpeg 在 webm 传输流中生成时间戳
- python - 读取多个文件夹中的图像
- ruby-on-rails - 版本控制之外的 Rails 视图模板
- python-3.x - Jinja2 获取排序列表中的第一项
- bash - 调用在另一个 bash 文件中声明的方法