我正在使用Visual Studio Code for C ++设置IDE,我已经在MinGW Compiler和Git中下载并安装了所有软件包以使用bash shell。
我遵循了本教程-> https://code.visualstudio.com/docs/cpp/config-mingw#_configure-debug-settings
但是,在我进行本教程的过程中,有一些小细节因我而异,我不清楚它们的影响(因为我是初学者)
我的代码是这样的:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c11",
"intelliSenseMode": "gcc-x64",
"compilerPath": "C:\\MinGW\\bin\\g++.exe"
}
],
"version": 4
}
仍然完成了本教程,并且按照本教程中的说明进行调试时,出现错误,指出helloworld.exe不存在。
如果有人能提供一些见解和解决这些错误的方法,我将不胜感激。
在回答时,请记住我是初学者。谢谢。
编辑:我正在使用的文件task.json的代码:
{
"version": "2.0.0",
"tasks": [
{
"label": "build hello world",
"type": "shell",
"command": "g++",
"args": [
"-g",
"-o",
"helloworld",
"helloworld.cpp"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
我正在使用的文件launch.json的代码:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/helloworld.exe",
"args": [],
"stopAtEntry": true,
"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
}
]
}
]
}