Visual Studio Code中的调试器会显示错误的错误窗口

时间:2019-07-18 16:55:37

标签: c++ visual-studio-code

我正在尝试为C ++设置Visual Studio代码,如该视频所示: https://www.youtube.com/watch?v=DIw02CaEusY&t=701s。我遇到的问题是在配置调试器时

每当尝试调试项目时,我都会得到一个奇怪的错误窗口:

  

“ preLaunchTask'g ++。exe构建活动文件'终止,错误   代码1”。

我尝试研究该错误,但没有发现有用的信息。我试过在StackOverflow上搜索类似的问题,但运气不佳。

这是我的task.json文件中的代码:

    {
       "version": "2.0.0",
       "tasks": [
           {
               "label": "echo",
               "type": "shell",
               "command": "g++ -g main.cpp",
               "group": {
                   "kind": "build",
                   "isDefault": true
               }
           },
           {
               "type": "shell",
               "label": "g++.exe build active file",
               "command": "C:\\MinGW\\bin\\g++.exe",
               "args": [
                   "-g",
                   "${file}",
                   "-o",
                   "${fileDirname}\\${fileBasenameNoExtension}.exe"
               ],
               "options": {
                   "cwd": "C:\\MinGW\\bin"
               }
           }
       ]
   }

这是我的launch.json文件:

      "version": "0.2.0",
        "configurations": [
            {
                "name": "g++.exe build and debug active file",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceFolder}/a.exe",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false,
                "MIMode": "gdb",
                "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ],
                "preLaunchTask": "g++.exe build active file"
            }
        ]
    }

0 个答案:

没有答案