Saturday, February 3, 2018
Set Up C++ Development With Visual Studio Code on Windows 10
In this video I am going to show, How to Set Up C++ Development With Visual Studio Code on Windows 10. We will use MinGW with VS code as our compiler and debugging tool. So First I will show How to install mingw. The we will see how to create, build and compile our first C++ Program on VScode.
With an updated VS Code you can do it in the following manner:
Hit (Ctrl+P) and type:
ext install cpptools
Open a folder (Ctrl+K & Ctrl+O) and create a new file inside the folder with the extension .cpp (ex: main.cpp):
Type in your code and hit save.
Press (Ctrl+Shift+P and type, Configure task runner and then select other at the bottom of the list.
{
"version": "2.0.0",
"tasks": [
{
"label": "build hello world",
"type": "shell",
"command": "g++",
"args": [
"-g", "helloworld.cpp"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Hit (Ctrl+Shift+B to run Build task. This will create the .obj and .exe files for the project.
For debugging the project, Hit F5 and select C++(Windows).
In launch.json file, edit the following line and save the file:
Below is an example using the MinGW GDB debugger:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\mingw\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build hello world"
}
]
}
Hit F5.
-------------------------Follow-------------------
My Website - http://www.codebind.com
My Blog - https://goo.gl/Nd2pFn
My Facebook Page - https://goo.gl/eLp2cQ
Google+ - https://goo.gl/lvC5FX
Twitter - https://twitter.com/ProgrammingKnow
Pinterest - https://goo.gl/kCInUp
Text Case Converter - https://goo.gl/pVpcwL
Epoch Timestamp Converter - https://goo.gl/Zedjo5
Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE
8-bit Checksum Calculator - https://goo.gl/inxvIT
-------------------------Stuff I use to make videos -------------------
Stuff I use to make videos
Windows notebook – http://amzn.to/2zcXPyF
Apple MacBook Pro – http://amzn.to/2BTJBZ7
Desktop - http://amzn.to/2zct252
Microphone – http://amzn.to/2zcYbW1
notebook mouse – http://amzn.to/2BVs4Q3
Partner Sites
VideoToGifs.com
EasyOnlineConverter.com
SqliteTutorials.com
Top Online Courses From ProgrammingKnowledge
Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ