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"
    
}
相关推荐
lanhuazui104 小时前
【Vscode】显示多个文件 & 打开多个文件时实现标签栏多行显示
vscode·编辑器
张较瘦_8 小时前
环境搭建 | [入门级]VSCode(Cursor|Trae|Qoder)搭建Java(Springboot3)企业开发环境全流程
java·ide·vscode
天赐细莲10 小时前
(Linux) WSL 通过 VSCode 连接不执行 profile 问题(登录Shell问题)
linux·运维·vscode
暮色驶过苍茫18 小时前
VSCode 配置 SSH 远程连接
ide·vscode·ssh
我狸才不是赔钱货1 天前
DevOps:打破开发与运维之间的高墙
运维·vscode·docker·devops
我狸才不是赔钱货1 天前
揭开命令行的面纱:终端、CLI、Shell的终极辨析
vscode·ssh·bash
空影星1 天前
SiriKali,一款跨平台的加密文件管理器
python·编辑器·电脑·智能硬件
TLucas1 天前
Layui连线题编辑器组件(ConnectQuestion)
前端·编辑器·layui
添砖java‘’2 天前
vim高效编辑:从入门到精通
linux·编辑器·操作系统·vim
非得登录才能看吗?2 天前
VScode 入门(设置篇)
ide·vscode·编辑器