该文章是我的经验总结,网集c站大佬关于c/c++和python配置的文章最后成功配置出了c/c++和python的调试设置的json格式文件
直接上代码
首先是launch.json文件
1.建立launch.json(不知道怎么建?没关系请按f5)
2.看着vscode默认的文件,不要急不要慌,小白不需要知道怎么多,直接对照我的文件操作,就算操作错误,直接删了重新来

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },
        {
            "name": "gcc.exe - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",#**这个地方换成你的minw里的gdb的地址**
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "task g++"
        }
    ]

3.复制我的文件,直接粘贴上去。
4.修改个地方 “miDebuggerPath”:这个地方换成你的minw里的gdb的地址

然后我们上第二个文件
task.json
1.创建task.json(还是老套路,回到你创建launch.json时的那个文件,再按一遍f5,然后点击配置任务。)

不跟你吹,老简单了
2.

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"label": "task g++",
			"command": "D:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe",
			"args": [
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "D:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build"
		}
	]
}

这个地方你需要观察默认文件里的command和cwd两个地方,判断这两个地方是不是正确的(结尾一般都是mingw64\bin\gcc.exe和mingw64\bin)

3.修改你的label项,这个地方必须和launch.json里的"preLaunchTask"一致。

这时基本上就可以使用c/c++的调试了
然后就是第三个文件了
c_cpp_properties.json

这个文件操作稍微多了一点
1.创建一个默认的文件

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**", 
                "D:/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
                "D:/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
                "D:/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
                "D:/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
                "D:/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
                "D:/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

2.上面时完整版文件,观察我的文件,你可以看到我的includePath里多了几行。这时你要找到属于你的这几行。
3.打开命令行(徽标+r),然后在命令行里输入cmd gcc -v -E -x c++ -
找到,复制,粘贴三步走战略.
是不是也很简单,哈哈哈

最后一个文件了
settings.json

{
    "files.associations": {
        "iostream": "cpp"
    },
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
         },
 "pythonPath":
 }

这里是需要将你的pythonPath改为你的python的安装地址。
(settings.json不知道在哪?1.ctrl+shift+p,然后搜索settings.json 2.创建,复制,粘贴,修改四步走战略)

就这四大文件,做完就完事了,可以摁f5来测试一下
就是这么简单,看的懂中文就能做到。(骗你没有xjj)

要是还是失败的话,那呃呃呃呃呃呃呃呃

看帖的朋友请不要问我,这几个文件是什么意思,我也不知道,好好学英语,将来到官方文档查看。既然你能在csdn搜索到我,看我的文章来配置而不是去官方文档,那咱们的英语水平应该差不多,祝各位兄弟姐妹们学业进步,水平越来越高。

更多推荐

集一众大佬的精华所做关于vscode同时配置c/c++和python的调试脚本