环境搭建--vscode

vscode官网下载合适版本

安装vscode插件

安装 MinGW

配置环境变量

把安装目录D:\mingw64 配置在用户的环境变量path里即可
选择用户环境变量path

点确定保存后开启cmd输入g++,如提示no input files 则说明Mingw64 安装成功,如果提示'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件则说明安装失败

配置 vscode

我的项目结构是这样的,incude文件夹下为.h文件 src文件夹下为.cpp文件

点击运行与调试

点击运行与调试---》G++(Windows)

打开launch.json

配置launch.json

cpp 复制代码
{
    "version": "0.2.0",//版本
    "configurations": [//配置
        {
            "name": "g++.exe build and debug active file",//名字
            "type": "cppdbg",
            "request": "launch",//要求
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",//
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true, //修改此项,让其弹出终端
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\SoftWare\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "task g++" //修改此项
        }
    ]
}

点击运行与调试---》

选择Others

配置

cpp 复制代码
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"label": "task g++", //修改此项
			"command": "D:\\SoftWare\\mingw64\\bin\\g++.exe",
			"args": [
				"-g",
				// "${file}",
				"${cwd}//src//*.cpp",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "D:\\SoftWare\\mingw64\\bin"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build"
		}
	]
}
相关推荐
2501_915909063 天前
移动端开发工具链怎么组合比较好,iOS、Android、跨端三套配置方案
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
weixin_464078073 天前
ppt转为draw.io方法
编辑器
sunoo-2293 天前
【ARM嵌入式学习笔记Day6】一文打通i.MX6ULL时钟体系:PLL/PFD/预分频+滞回比较器全解析
arm开发·笔记·vscode·单片机·imx6ull·汇编语言
明天…ling3 天前
gitee与vscode远程连接
vscode·gitee
2501_915918414 天前
iOS编程用什么软件好?主流工具Xcode、AppCode、CodeRunner与新兴快蝎对比
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
__pop_4 天前
VSCode Remote SSH 远程连接 glibc 高版本依赖问题
vscode
daxiangxm4 天前
【趣味休息】“围住小猫在线玩”-“困住小猫”,又回来了
数据结构·人工智能·vscode·github·php
星光开发者4 天前
基于Spring Boot的充电桩管理系统的设计与实现-计算机毕设【课程设计】57105
vue.js·spring boot·vscode·mysql·django·php·express
程序员允诺5 天前
内网/无网环境必备:VS Code Remote-SSH 离线包下载与手动部署教程
vscode
滕州市燕猫虎计算机科技工作室个体工商户5 天前
IDEA:Command line is too long
java·ide·intellij-idea