我有 Windows 7,有几个不同版本的 Visual Studio 和 MinGW。当我创建一个 cmake 项目并在 Visual Studio Code 中打开它时,它会自动配置为使用 Visual Studio 14 编译器,我还安装了 Visual Studio 17 和 19,版本 17 已安装。
我想知道如何设置运行初始配置时(当构建文件夹为空时)使用哪个编译器以及如何创建调试配置。当我运行不需要配置的普通调试按钮时,断点不会触发。我尝试过在 launch.json 中使用这些配置文件
"Desktop development with C++" workload.
这些都不起作用,
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"env": {
"Path": "${env:Path};D:\\Installation\\oracClient 19\\instantclient_19_14\\"
},
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "c:\\Users\\marko.grujic.CHIP\\.vscode\\extensions\\ms-vscode.cpptools-1.8.4\\debugAdapters\\bin\\WindowsDebugLauncher.exe",
"logging": {
"engineLogging": true
},
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(Windows) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"env": {
"Path": "${env:Path};D:\\Installation\\oracClient 19\\instantclient_19_14\\"
},
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
"logging": {
"engineLogging": true
},
"console": "externalTerminal"
}
]
配置不起作用,因为代码是用 Visual Studio 编译器编译的,并且我正在尝试使用 MinGW 调试器(这是假设)。
(gdb) Launch
也不起作用,但我不知道为什么,它确实无限期地运行,但没有一个断点起作用。删除构建文件夹。
(Windows) Launch
CMake: scan for kits