VSCode使用MSVC编译器

1.其他大佬的配置:下载和安装库环境

2.安装好C/C++插件<选择1.8.4的版本最好>。

3.分别生成对应的默认模板即可。但是其中参数可能需要配置。
task.json

cpp 复制代码
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: cl.exe build active file",
			"command": "cl.exe",
			"args": [
				"/Zi",
				"/EHsc",
				"/nologo",
				"/Fe:",
				"${fileDirname}\\${fileBasenameNoExtension}.exe",
				"${file}"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$msCompile"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "compiler: cl.exe"
		}
	]
}

launch.json

cpp 复制代码
{
{
    // 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": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [
            ],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "console":"integratedTerminal"
        },
        
        
    ],
    "preLaunchTask": "C/C++: cl.exe build active file"
    
}
相关推荐
要加油哦~11 小时前
工具 | 解决 VSCode 中的 Delete CR 问题
ide·vscode·编辑器
taoismimortal1 天前
vscode目录,右键菜单加入用VSCode打开文件和文件夹(快速解决)(含删除)(脚本)
ide·vscode·编辑器
猫咪的白手套1 天前
解决VSCode中“#include错误,请更新includePath“问题
ide·vscode·编辑器
天安彩1 天前
mac下 vscode 运行 c++无法弹出窗口
c++·vscode·macos·clang
白日与明月1 天前
Hive-vscode-snippets
hive·hadoop·vscode
橘子味的茶二1 天前
vsCode如何远程服务器不需要每次输入密码
服务器·ide·vscode
鑫宇吖2 天前
IAR编辑器如何让左侧的工具栏显示出来?
编辑器·嵌入式·c·iar
咩咩觉主2 天前
Unity编辑器拓展 IMGUI与部分Utility知识总结(代码+思维导图)
unity·c#·编辑器·游戏引擎
William.csj2 天前
VSCode——python选择解释器消失的解决办法
vscode·编辑器
滴水成川2 天前
现代 C++ 开发工作流(VSCode / Cursor)
开发语言·c++·vscode·cursor