【发布时间】:2020-02-25 17:24:29
【问题描述】:
根据this link,.natvis 文件可用于可视化原生对象。具体来说,我希望能够使用this .natvis file 检查Eigen::Matrix 对象。
但是,上面的链接不包含有关如何在 VS Code 中实际使用 .natvis 文件的任何信息。是否可以使用自定义 .natvis 文件?
这是我的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": "g++-8 build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++-8 build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
【问题讨论】:
-
我不知道VS Code,但是尝试进入VS Code的安装目录,并搜索现有的natvis文件。将新的复制到同一目录,重新启动 VS Code,看看是否有效。 (这适用于常规 VS)
-
如果我没记错的话,只需在源代码旁边放一个
.natvis就足够了。试试看!
标签: c++ ubuntu visual-studio-code g++ natvis