当前位置:网站首页>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
边栏推荐
- Using JWT to realize login function
- Pytest installation (command line installation)
- Interview question: general layout and wiring principles of high-speed PCB
- Leetcode刷题记录(数组)组合总和、组合总和 II
- Test Engineer Interview Questions 2022
- Difference between interface iterator and iteratable
- Mysql database transaction learning notes
- 软件建模与分析
- Network request process
- 战略合作|SubQuery 成为章鱼网络浏览器的秘密武器
猜你喜欢

C language pointer (Part 2)

战略合作|SubQuery 成为章鱼网络浏览器的秘密武器

Postman interface test (I. installation and use)

PMP Exam Preparation experience systematically improve project management knowledge through learning

Nested (multi-level) childrn routes, query parameters, named routes, replace attribute, props configuration of routes, params parameters of routes

数据建模中利用3σ剔除异常值进行数据清洗

Locust performance test 4 (custom load Policy)

What is the use of PMP certificate?

Unittest simple project

答案在哪里?action config/Interceptor/class/servlet
随机推荐
How long does the PMP usually need to prepare for the exam in advance?
Several stages of PMP preparation study
Do you have any certificates with high gold content?
华为HCIP-DATACOM-Core_03day
Summary of PMP learning materials
liunx命令
Common short chain design methods
PMP Exam Preparation experience, seek common ground while reserving differences, and successfully pass the exam
Detailed learning notes of JVM memory structure (I)
信息安全实验一:DES加密算法的实现
What are the conditions for applying for NPDP?
Chaosblade: introduction to chaos Engineering (I)
shake数据库中怎么使用Mongo-shake实现MongoDB的双向同步啊?
Nested (multi-level) childrn routes, query parameters, named routes, replace attribute, props configuration of routes, params parameters of routes
Skill review of test engineer before interview
Some pit avoidance guidelines for using Huawei ECS
Record of structured interview
Information Security Experiment 2: using x-scanner scanning tool
Yapi test plug-in -- cross request
[chaosblade: delete pod according to the tag, pod domain name access exception scenario, pod file system i/o failure scenario]