嗨,
我对VS Code上的C ++编程很陌生,所以我要问几个问题。
我的软件规格:
我必须在编程时调试许多多维数组,因此我想在“变量”窗口(“观察”窗口也可以)中了解一种如何查看2D数组的方法。矩阵的形式。
目前,我的变量窗口看起来像这样Zip-Ada
我希望它类似于
我知道可以使用发布在上的方法查看2D数组,但是我想在VSCode的debug选项卡中查看它。有没有漂亮的打印方法或代码可以帮助我实现目标?
在停止C ++的调试过程之后,终端上会出现某种消息。看起来就是这样-here
我从打开用于调试的外部终端切换为使用内置终端,因为在停止调试过程之后,会显示上述消息,并且终端不会自动退出,因此必须手动关闭终端。在Windows上不是这种情况,在Windows上,终端将在调试后自动退出。有什么方法可以防止此消息(在调试完成或停止后出现)?
我想使用外部终端进行调试,所以有什么方法可以删除此错误消息,或者在调试关闭后自动退出?
c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++-8",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"setupCommands": [
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"_runner": "terminal",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "g++-8",
"args": [
"-g",
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
答案 0 :(得分:1)
我想您的选择是编写自己的gdb pretty printer或切换到lldb以及以下允许高级可视化的扩展:https://github.com/vadimcn/vscode-lldb/wiki/Data-visualization