当前位置:网站首页>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
边栏推荐
- Cesium load vector data
- Selenium mouse sliding operation event
- Implementation of corner badge of Youmeng message push
- 嵌套(多级)childrn路由,query参数,命名路由,replace属性,路由的props配置,路由的params参数
- PMP Exam details after the release of the new exam outline
- Mysql database transaction learning notes
- SiteMesh getting started example
- Difference between interface iterator and iteratable
- Full link voltage test of the e-commerce campaign Guide
- C language pointer (Part 2)
猜你喜欢
Cesium load vector data
Run can start normally, and debug doesn't start or report an error, which seems to be stuck
Connecting mobile phone with ADB
Confitest of fixture py
PMP certificate preparation experience sharing
Postman data driven
網易雲微信小程序
Install pyqt5 and Matplotlib module
Netease cloud wechat applet
[cloud native] Devops (I): introduction to Devops and use of code tool
随机推荐
What is MD5
stm32和电机开发(从单机版到网络化)
Port multiplexing and re imaging
NATAPP内网穿透
信息安全实验一:DES加密算法的实现
Connecting mobile phone with ADB
Colorbar of using vertexehelper to customize controls (II)
二叉树高频题型
Postman interface debugging method
DRF authentication, permissions, and flow restrictions (only for views in DRF)
2021 year end summary
Postman interface test (I. installation and use)
Information Security Experiment 2: using x-scanner scanning tool
战略合作|SubQuery 成为章鱼网络浏览器的秘密武器
How does the project manager write the weekly summary and weekly plan?
JMeter JDBC batch references data as input parameters (the simplest method for the whole website)
C language pointer (Part 2)
超十万字_超详细SSM整合实践_手动实现权限管理
JVM garbage collection detailed learning notes (II)
信息安全实验三 :PGP邮件加密软件的使用