fortran77代码调试配置

目录架构

--.vscode
   -launch.json
   -tasks.json
--hello_fort.for
--f_print.for

hello_fort.for

        program main
            integer(8):: i,num
            call print('hello, world!')
            num = 10
            do i=1,num
                write(*,*) i
            enddo
            call print('end')
        end program

f_print.for

        subroutine print(msg)
            character(*) msg
            write(*,*) msg
        end subroutine

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
    "name": "(gdb) debug hello_fort",
    "preLaunchTask": "make build", //在launch之前运行的任务,对应tasks.json中的任务
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/hello_fort", //需要运行的可执行文件
    "args": [], //命令行参数
    "stopAtEntry": false, // 选为true则会在打开控制台后停滞,暂时不执行程序
    "cwd": "${workspaceFolder}", // 当前工作路径
    "environment": [],
    "externalConsole": false, // 是否使用外部控制台
    "MIMode": "gdb",
    "miDebuggerPath": "D:\\softwares\\mingw64\\bin\\gdb.exe",
    "setupCommands": [
        {
        "description": "Enable pretty-printing for gdb",
        "text": "-enable-pretty-printing",
        "ignoreFailures": true
        }
      ]
    }
  ]
}

tasks.json

{
  "version": "2.0.0",
  "tasks": [
    { // 可以通过ctrl+shift+P, Tasks:Run Task 调用任务
    "label": "build",
    "type": "shell",
    "command": "gfortran",
    "args": [
            "-g",
            "f_print.for",
            "hello_fort.for",
            "-o",
            "hello_fort"
            ],
    "problemMatcher": [],
    "group": {
        "kind": "build",
        "isDefault": false
        }
    },
    {
    "label": "clean",
    "type": "shell",
    "command": "rm -f *.o hello_fort",
    "problemMatcher": []
    },
    {
    "label": "make build",
    "type": "shell",
    "command": "mingw32-make  ",
    "problemMatcher": [],
    "group": {
      "kind": "build",
      "isDefault": true // 可以用ctrl+shift+B快捷调用默认的构建任务
      }
    }
  ]
}

最后进行调试即可

进行调试即可

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值