Vscode配置C语言开发环境遇到的问题

1、vscode从微软官方下载比较慢,可以把下载地址前段替换为:https://vscode.cdn.azure.cn,如原地址为:https://az764295.vo.msecnd.net/stable/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/VSCodeUserSetup-x64-1.65.2.exeicon-default.png?t=M276https://az764295.vo.msecnd.net/stable/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/VSCodeUserSetup-x64-1.65.2.exe

可以替换为:https://vscode.cdn.azure.cn/stable/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/VSCodeSetup-x64-1.65.2.exeicon-default.png?t=M276https://vscode.cdn.azure.cn/stable/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/VSCodeSetup-x64-1.65.2.exe

替换后下载速度快很多

2、配置调试gcc出现:找不到任务"gcc"、找不到任务“g++.exe”、"launch: program ...... does not exist",我也是按网上的配置修改了很久,一直解决不了。后来不记得在哪看到一个配置文件,复制过来就解决了。现在这里放上launch.json和tasks.json的配置文件供参考:

 launch.json配置内容如下:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,//弹出控制台窗口
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\mingw64\\bin\\gdb.exe",//自己调试器位置
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ]
}

tasks.json配置文件内容如下:

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"label": "C/C++: g++.exe build active file",
			"command": "C:\\mingw64\\bin\\g++.exe",
			"args": [
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "${workspaceFolder}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "test",
				"isDefault": true
			}
		}
	]
}

3、题外话:推荐两个vscode主题,个人感觉挺不错的。第一个GitHub Theme,第二个One Dark Pro。这两个直接在vscode扩展中搜索即可 

 

你可能感兴趣的:(C语言,vscode,c语言)