欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Vscode、cygwin配置gfortran

程序员文章站 2022-07-14 15:43:56
...

一、通过cygwin安装gcc、gfortran、gdb

    cygwin安装完成后,将bin文件夹添加到系统环境变量

二、Vscode插件安装

    依次安装c/c++、fortran、fortran break point插件

三、在.vscode内新建launch.json

内容如下

{
    "version": "0.0.1",
    "configurations": [
        {
            "name": "Fortran Launch (GDB)",
            "type": "cppdbg",
            "request": "launch",
            "targetArchitecture": "x86",
            "program": "${workspaceRoot}\\${fileBasenameNoExtension}.exe",
            "miDebuggerPath": "gdb.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "externalConsole": true,
            "preLaunchTask": "gfortran"
        },
        {
            "name": "Intel Debug Attach",
            "type": "cppvsdbg",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ] }

四、在.vscode内新建tasks.json

内容如下

{
    "version": "2.0.0",
    "command": "gfortran",
    "args": [
        "-g",
        "${file}",
        "-o",
        "${workspaceRoot}\\${fileBasenameNoExtension}.exe"
    ]
}

五、F5启动调试即可