当前位置:网站首页>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
边栏推荐
- JWT certification used in DRF
- 数据库多表关联查询问题
- Mysql数据库-锁-学习笔记
- 信息安全实验二 :使用X-SCANNER扫描工具
- 信息安全实验四:Ip包监视程序实现
- PMP certificate preparation experience sharing
- Regularly modify the system time of the computer
- Locust performance test 3 (high concurrency, parameter correlation, assembly point)
- golang select机制和超时问题怎么解决
- Difference between interface iterator and iteratable
猜你喜欢
What are the conditions for applying for NPDP?
如何使用clipboard.js库实现复制剪切功能
NATAPP内网穿透
C language pointer (Part 1)
Two schemes of unit test
答案在哪里?action config/Interceptor/class/servlet
Sublime Text4 download the view in bower and set the shortcut key
Jmeters use
Kubernetes cluster capacity expansion to add node nodes
Install pyqt5 and Matplotlib module
随机推荐
华为HCIP-DATACOM-Core_03day
SAP MM STO单据的外向交货单创建后新加ITEM?
Mysql database index study notes
Pick up the premise idea of programming
Huawei HCIP - datacom - Core 03 jours
信息安全实验二 :使用X-SCANNER扫描工具
Record of structured interview
liunx命令
Information Security Experiment 1: implementation of DES encryption algorithm
Original collection of hardware bear (updated on May 2022)
十二、排序
Redis common commands
What is MD5
Leetcode刷题记录(数组)组合总和、组合总和 II
網易雲微信小程序
JVM 内存结构 详细学习笔记(一)
Netease cloud wechat applet
【SVN】SVN是什么?怎么使用?
Install pyqt5 and Matplotlib module
What is the use of PMP certificate?