Dust Falling Wood
TO BE THE BEST!

Text editor VScode v1.18.1 and how to write C++code with it

On November 17, Microsoft released vscode 1.18. Version 1 (The 1.17 orange icon is finally changed) Official website address

Well, that's all for the update information about the software. You can see the brief introduction of the software Previous vscode blog posts

How to build C/C++development environment with vscode

1、 Install the C language compilation environment gcc

1.1 Linux/Mac operating system comes with gcc/g++compiler, which does not need to be installed

1.2 The C/C++compiler for Windows can download a mingw

Mingw download address

1.2.2 Configure gcc/g++Environment Variables

In fact, Mingw installer will automatically add environment variables, but I still write environment variables for content integrity

2、 Install vscode and get familiar with some shortcut keys

2.1 Familiarize yourself with shortcut keys

Shortcut key combination 1: Ctrl+`<Open/close system shell command line>

Shortcut key combination 2: Ctrl+Shift+P<Open vscode command line>

Shortcut key combination 3: Alt+left mouse button<Edit multiple lines at the same time>

There is no shortcut key combination 4, because the landlord really only knows the above three

2.2 Personal preference configuration

Use the shortcut key Ctrl+Shift+P to enter the vscode command board (Command Palette)

First, change your vscode language to English

Someone on Zhihu said that the language preference is Chinese, which may cause errors in the vscode command board (meaning that only Chinese commands can be typed)

Continue on the vscode command board, enter preference to enter the configuration file (a file in json format)

Then configure it according to personal preferences, such as whether the tab indent is two or four spaces, UI color and theme, etc

3、 Write C++code

3.1 Create a new. cpp file, open the terminal window, and use the cd command to switch to the file path

3.2 Write a small program to save it. It is recommended to use Ctrl+S skillfully

3.3 Press Ctr to the command line, compile and run the code in the terminal window

Powershell

g++ test.cpp -o test ; ./test

There is a problem with this command. If the compilation command on the left side of the semicolon reports an error, it will still run on the right side of the branch

cmd

g++ test.cpp -o test && test

Bash Shell(Linux)/Mac OS terminal

[code language=”bash”]
g++ test.cpp -o && ./test
[/code]

3.4 Repeat the operations in 3.2 and 3.3 to quickly modify the operation procedure

The following GIF demonstrates how to modify the output result of the program (the second run, the output result has an extra line of 'c.cpp')

The last thing I want to say

This article was written by Anonymous, an enthusiastic reader, to share the pressure of bloggers to update software information

Also share personal technical articles. As the first non blogger article, readers can leave any suggestions in the comment area

Copyright @ copyright notice: This article is not allowed to be reproduced. I only publish it on this site and my future Google blog (blogspot)

Like( zero ) appreciate
 Dusty Wood Public Account
Copyright notice: This article is authorized by the Knowledge Sharing Attribution 4.0 International License Agreement [BY-NC-SA]
Article name: Text Editor VScode v1.18.1 and how to write C++code with it
Article link: https://www.luochenzhimu.com/archives/729.html
Disclaimer: According to Article 17 of the Regulations on the Protection of Computer Software in China: "In order to learn and study the design ideas and principles contained in the software, those who use the software by installing, displaying, transmitting or storing the software may not be licensed by the software copyright owner and will not be paid." You need to know that all content resources of this website are from the network, It is only for users to exchange, study and research. The copyright belongs to the original copyright owner. The copyright dispute has nothing to do with this site. After downloading, users cannot use it for commercial or illegal purposes. It needs to be deleted within 24 hours, or the consequences will be borne by users.

Related recommendations

comment Grab the sofa

You must log in before commenting!

 

Your support will encourage us to continue to create!

Scan Alipay and reward

Scan WeChat and reward