问题描述
我正在运行一个简单的 C++ 程序并在 VS Code 中设置了一个断点。当我选择“Run without Debugging”时,会在断点处停止。这是设计还是错误?至少,它的行为与 good & ole Visual Studio 不同。 提前致谢。
供您参考,我的tasks.json
如下所示:
{ // build hellowhox
"type": "cppbuild","label": "build hellowhox","command": "C:/msys64/mingw64/bin/g++.exe","args": [
"-g","-DDEBUG","-o","${cwd}/hellowhox","${cwd}/hellowhox.cpp",],"options": {
"cwd": "C:/msys64/mingw64/bin"
},"problemmatcher": [ "$gcc" ],"group": "build","detail": "compiler: C:/msys64/mingw64/bin/g++.exe"
},
launch.json
如下图:
"configurations": [
{
"name": "g++.exe","type": "cppdbg","request": "launch","program": "${cwd}/hellowhox.exe","args": [],"stopAtEntry": false,"cwd": "C:\\msys64\\mingw64\\bin","environment": [],"externalConsole": false,"MIMode": "gdb","miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe","setupCommands": [
{
"description": "gdb","text": "-enable-pretty-printing","ignoreFailures": true
}
],"prelaunchTask": "build hellowhox"
}
解决方法
最后,我从 VS Code-cpptools 开发团队那里得到了答案。它既不是设计也不是错误,但尚未实现。^^
供您参考:
#5680 的重复
cpptools 调试器(cppvsdbg 和 cppdbg)不支持不调试就运行。 我们忽略 LaunchRequestArguments 中的 noDebug 布尔值。我们将开始一个调试会话。 这将需要实施。
见:#5680(评论)