如题,问题产生的原因是缺少什么东西还是插件没有安装到位呢?环境的配置参考了好几个攻略都出现了以上问题。
引用 皆我百晓生 小程序回复内容作答:
可能是因为缺少C/C++插件导致没有出现C/C++选项。你可以按照以下步骤来安装C/C++插件:
安装完成后,重新打开launch.json文件,应该会出现C/C++等选项。如果还是没有出现,请确保你的VS Code和插件是最新版本,并确保你的C/C++编译环境已正确配置。
另外,如果你是第一次使用C/C++插件,可能还需要进行一些额外配置。你可以参考官方文档或其他攻略中的说明来完成配置。
【相关推荐】
在最上面一行选择Run > Add Configuration,然后选择C++(GDB/LLDB),然后选择g++.exe build and debug active file
{
// 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++.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "D:\\MSYS2\\msys64\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe 生成活动文件"
}
]
}