有什么方法可以使用gfortran在Visual Studio上工作?我使用Cygwin安装了Windows 10,Visual Studio 2019和gcc 7。
假设Cygwin的安装路径是D:\Cygwin
并且gcc-fortran
Cygwin中已经安装了软件包。
%PATH%
在控制面板的环境变量中添加Cygwin安装文件夹。HelloWorld.f90
在文件夹中创建文件:program hello
print *,"Hello World!"
end program hello
tasks.json
文件.vscode
夹中的文件。{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "D:\\Cygwin\\bin\\gfortran.exe",
"args": [
"HelloWorld.f90"
],
"group": "build",
"presentation": {
"reveal": "always"
}
}
]
}
args
在上述JSON文件的字段中添加其他必需参数。如果安装了其他软件包,则gfortran路径将不同。(可选)可以从Visual Studio MarketPlace下载fortran扩展以突出显示语法。有关更多信息,请阅读VSCode中的任务
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句