c++ - Visual Studio Code 中的调试器显示神秘的错误窗口
问题描述
我正在尝试为 C++ 设置 Visual Studio 代码,如该视频所示: https ://www.youtube.com/watch?v=DIw02CaEusY&t=701s 。我遇到的问题是在配置调试器时,
每当我尝试调试项目时,我都会收到一个奇怪的错误窗口:
“preLaunchTask 'g++.exe build active file' 以错误代码 1 终止”。
我已尝试研究该错误,但没有显示任何有用的信息。我曾尝试在 StackOverflow 上搜索类似问题,但运气不佳。
这是我的 tasks.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"
}
]
}
解决方案
推荐阅读
- javascript - 数组内的值差异
- ruby-on-rails - 如何在使用 Rails Mailer Preview 时保持干净的开发数据库
- excel - Excel 应用程序在使用 Microsoft.Office.Interop.Excel 初始化对象时冻结
- copy - 如何在 SuSE 12.5 的文件目录中的所有文件上附加副本
- apache-spark - Spark 托管和非托管表
- sql - Grafana SQL 查询局部变量
- postgresql - 来自任意数量的人的 Postgress 时间序列存储
- java - Fluent builder设计模式——如何强制客户设置变量
- amazon-web-services - 不同客户端对 S3 的访问不同(CyberDuck 与 ExpanDrive)
- javascript - 通过 JQuery 函数传递 HTML 名称