tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++.exe 生成活动文件", //
			"command": "D:\\code\\sfml3_0\\mingw64_1420\\bin\\g++.exe", //
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"*.c"  //*.cpp
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "编译器: D:\\code\\sfml3_0\\mingw64_1420\\bin\\g++.exe",
			"presentation": {	// 
				"reveal": "silent",
				"revealProblems": "onProblem",
				"close": true
			}
		}
	]
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C/C++: g++.exe 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\a.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}", //
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\code\\sfml3_0\\mingw64_1420\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe 生成活动文件" //
        }
    ]
}

code runner 插件,

"code-runner.executorMap": {
        "c": "cd $dir && gcc *.c -std=c17 -fexec-charset=gbk && ./a",
        "cpp": "cd $dir && g++ *.cpp -std=c++17 -Wall -fexec-charset=gbk -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system && ./a",
        "python": "python"
    },

更多推荐