windows10 set up guidelines based build environment debugging of C ++ language VSCode

1. Install Visual Studio Code

Visual Studio Code (hereinafter referred to as vscode) is a lightweight and strong ⼀ zoomed code editor, ⽀ support Windows, OS X and Linux.

Built-in JavaScript, TypeScript and Node.js ⽀ hold on it and has a rich ecosystem of plug-ins ⽣, by installing plug-ins ⽀ support C ++, C #, Python, PHP and other language you want.

 Download: https://code.visualstudio.com/#alt-downloads

 

 

Double-click the installation package to fool installation, has been point next, configure their own installation path, environment variables, check Add to path. After successful installation start VScode.

Below install Chinese language pack, press ctrl + shift + p in the pop-up search box, configure the input language select configure display language, choose to install other languages, click on the back of Chinese install installation.

 

2. Install the Microsoft C / C ++ extension

Click below on the left most column of the extended column, C ++ in the search box, click install, install C ++

 

3. Install the C ++ compiler debugging environment

C / c ++ extension does not include a c ++ compiler or debugger, you need to install these tools.

GCC is Mingw-w64 for Windows 64-bit and 32 - Download: http://mingww64.org

Download and when running a MinGW-W64-install.exe, the installation process has to get accustomed options should be noted:

• Version develop a version number, from 4.9.1-8.x.0, demand options, there are no special requirements on Using the latest version of it;

• Architecture related with the operating system, 64-bit system selection x86_64,32 system selection i686;

• Threads Thread Set posix standard or optional win32;

• Exception Setting exception handling system, x86_64 optionally seh and sjlj, i686 is a dwarf and sjlj;

• Build revision build number, you can choose the most zoomed.

• Add the environment variable, the bin directory to the PATH, open CMD, YES gcc -v to see if the installation was successful

 

4. Construction of debugging environment

Create a test folder, create a new file in the folder .vscode test.cpp files and folders. Written in test.cpp output "hello word!" Code

 

Before building, you need to create takes.json file for the current project, tells the compiler to compile the file.

Select the menu bar at the top of the terminal configuration tasks generated by default, select the second ++ G. Build the Active EXE File , it will automatically generate a file in the .vscode tasks.json file.

Can then be compiled, enter the command in the terminal g ++ -o test test.cpp, generating test.exe file. Enter ./test run, print out "hello word!"

 

Finally, the program also need to debug, need to build launch.json file.

Select the top menu bar running add configuration, select C ++ (GDB / LLDB), select the g ++. Exe- build and debug the active file, the file is automatically generated launch.json under .vscode file.

Marked in code breakpoints, start the debugger, stop at the breakpoint, it will continue to press the next breakpoint.

 

Guess you like

Origin www.cnblogs.com/qfdzztt/p/12614625.html