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"
    
}
相关推荐
努力的小帅9 分钟前
Ubuntu 使用 avahi/mDNS 实现固定连接(VSCode Remote SSH + NoMachine)
linux·vscode·ubuntu·ssh·linux入门
十年之少24 分钟前
使用VSCode 对PyQt5 say Hello—— Python + Qt 开发
vscode·python·qt
MuYiLuck1 小时前
02-VSCode插件与Trae原生AI编辑器实战教程
vscode·编辑器·trae·trae solo
小此方1 小时前
Re:Linux系统篇(十)工具篇 · 二:Vim 编辑器深度解析:从基础模式到高效配置
linux·编辑器·vim
www.022 小时前
通过 SSH 隧道将 GPT 调教为服务器专属 Agent(个人记录)
linux·服务器·vscode·gpt·大模型·ssh·api转发
2501_916008894 小时前
Xcode功能、下载、反馈与版本支持详细解析
ide·vscode·macos·ios·个人开发·xcode·敏捷流程
容智信息16 小时前
AI Agent(智能体)的输出格式应该从 Markdown 转向 HTML吗?
前端·人工智能·rust·编辑器·html·prompt
ONLYOFFICE18 小时前
如何通过创建插件,自动化Office文档中的重复操作
自动化·编辑器·onlyoffice·插件
shimly12345621 小时前
vscode 很难删除 copilot,如何关闭 copilot 功能?
ide·vscode·copilot
Waay1 天前
Linux Shell 知识点考评(三):awk文本分析(附答案)
linux·服务器·编辑器