当前位置:网站首页>VSCode+mingw64
VSCode+mingw64
2022-07-07 09:25:00 【heater404】
This article records in Windows The configuration VSCode Use MinGW Of g++ The compiler and GBD The debugger . The official tutorial is :Get Started with C++ and Mingw-w64 in Visual Studio Code
One 、 Installation preparation
install VSCode And C/C++ Extension plug-ins ; install MinGW64 And set the environment variable . No introduction here , Refer directly to the official tutorial .
Two 、 compile


Follow the operation sequence in the above figure , We will find that in the .vscode There is one more... In the folder tasks.json file . The contents of the document are as follows :

About more tasks.json Documents can refer to :Tasks in Visual Studio Code.
About more tasks.json The variables in the file can be referred to :Visual Studio Code Variables Reference.
We will change the compilation output directory to :"${fileDirname}\bin\${fileBasenameNoExtension}.exe". And then found out in bin There are executable files we want in the directory , You can use the terminal to run .
3、 ... and 、 debugging


After the above operation , Can be in .vscode It was found in the file that launch.json File generation .

And then use F5 You can debug breakpoints .
Four 、C/C++ To configure
In the command panel , Enter and select C/C++ Edit the configuration (UI), Will pop up C/C++ Configuration page . And then in .vscode In the folder, you will find the generation c_cpp_properties.json file .

If the header file used in the program is not in the workspace or the path of the standard header file , Can be in Include path Add search path in .
5、 ... and 、 Multi file compilation and debugging
For the compilation of multiple files , We need to change tasks.json In file args Parameters : take " f i l e " repair Change by " f{ile}" It is amended as follows " file" repair Change by "{fileDirname}\*.cpp".${fileDirname}- It refers to the currently open file directory , So the above parameter refers to test.cpp All under the directory of the file cpp file . Be careful , If in test.cpp There are... In the folder under the directory cpp There is no way to find the document , Must be with test.cpp Same directory .

If there are multiple folders cpp The file needs to be compiled , I don't know how to write this directory parameter ....
But for multi file compilation, it seems that you need to use cmake 了 . You can read this article :VSCode+mingw64+cmake
边栏推荐
- 超十万字_超详细SSM整合实践_手动实现权限管理
- STM32 clock system
- Postman interface test (II. Set global variables \ sets)
- Jemter operation
- Jenkins automated email
- Systick tick timer
- 華為HCIP-DATACOM-Core_03day
- STM32的时钟系统
- [chaosblade: node disk filling, killing the specified process on the node, suspending the specified process on the node]
- Chaosblade: introduction to chaos Engineering (I)
猜你喜欢

STM32 and motor development (from stand-alone version to Networking)

Variable parameter of variable length function

【云原生】DevOps(一):DevOps介绍及Code工具使用

2021 year end summary

二叉树高频题型
![Pytest+request+allure+excel interface automatic construction from 0 to 1 [familiar with framework structure]](/img/33/9fde4bce4866b988dd2393a665a48c.jpg)
Pytest+request+allure+excel interface automatic construction from 0 to 1 [familiar with framework structure]

PMP Exam details after the release of the new exam outline

Locust performance test 2 (interface request)

Jmeters use

C language pointer (Part 1)
随机推荐
Chaosblade: introduction to chaos Engineering (I)
When inputting an expression in the input box, an error is reported: incorrect string value:'\xf0\x9f... ' for column 'XXX' at row 1
scrapy爬虫mysql,Django等
What is the value of getting a PMP certificate?
JVM 垃圾回收 详细学习笔记(二)
E-commerce campaign Guide
[chaosblade: node disk filling, killing the specified process on the node, suspending the specified process on the node]
Regular matching starts with XXX and ends with XXX
Information Security Experiment 1: implementation of DES encryption algorithm
PMP Exam details after the release of the new exam outline
Redis common commands
Nested (multi-level) childrn routes, query parameters, named routes, replace attribute, props configuration of routes, params parameters of routes
Pytest+request+allure+excel interface automatic construction from 0 to 1 [familiar with framework structure]
Network request process
C language pointer (special article)
Leetcode question brushing record (array) combination sum, combination sum II
MongoDB怎么实现创建删除数据库、创建删除表、数据增删改查
[cloud native] Devops (I): introduction to Devops and use of code tool
DRF authentication, permissions, and flow restrictions (only for views in DRF)
How to use Arthas to view class variable values