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"
    
}
相关推荐
AI松子66611 小时前
vscode远程docker容器时报错
ide·vscode·docker
dgvri14 小时前
Node.js使用教程
node.js·编辑器·vim
计算机安禾14 小时前
【Linux从入门到精通】第10篇:软件包管理——Linux如何安装与卸载软件
java·linux·运维·服务器·编辑器
hjuan___14 小时前
给 Claude Code 装上“技能库”和“眼睛”:配置 Skills 与图片识别实战
vscode·minimax·mcp·ai 编程·claude code·cc switch
❀͜͡傀儡师15 小时前
GitHub Copilot for VS Code 中文使用完整教程
vscode·github·copilot
白头小黄15 小时前
ESP32+VScode+PIO实现基础的自带USB接口的JTAG调试
ide·vscode·编辑器
被放养的研究生16 小时前
vscode-settings.json(直接复制使用,带有注释)
ide·vscode·json
凤年徐17 小时前
Vim编辑器使用详解:多模式、常用命令与配置技巧
linux·编辑器·vim
ILYT NCTR17 小时前
vscode配置django环境并创建django项目(全图文操作)
vscode·django·sqlite
2501_9159184117 小时前
快蝎iOS开发IDE:免Xcode开发,支持Swift/Flutter项目
ide·vscode·ios·个人开发·xcode·swift·敏捷流程