Home  >  Article  >  Development Tools  >  How to write c program with vscode

How to write c program with vscode

王林
王林Original
2020-04-15 13:44:095824browse

How to write c program with vscode

1. Obtain C/C extension

1. Open vscode

2. ctrl shift x open store

3. Search C/C to install and restart vscode

How to write c program with vscode

2. Install GCC

1. Download MinGW

2. Open the installation program and install Go to the D drive (you need to create the MinGW folder). After the installation is completed, the MinGW installation manager

3 is generated. The manager opens automatically (if not, please do it manually), click All Packages, select gcc.bin, g .bin , gdb.bin, click Installation, select Apply Changes, click Apply to submit for installation

How to write c program with vscode

##win R, enter control to enter the control panel, click System and Installation->System ->Advanced System Settings->Environment Variables, find Path->Edit->New, and paste the path to the bin folder of the installed MinGW.

How to write c program with vscode

3. Configure intelligent prompts

1. Write a test file demo.c, click on the "prompt light" under the imported standard library, and generate c_cpp_properties .json file

2. Edit c_cpp_properties.json

How to write c program with vscode##c_cpp_properties.json and modify the content as follows:

How to write c program with vscode4. Enable debugging

F5 or Ctrl F5 to enable debugging, select C (GDB/LLDB) to generate the launch.json file, modify it as follows:

How to write c program with vscodeCtrl Shift P Enter Tasks:Configure Task to configure the task, choose to use the module to create the task.json file, select the Others template, generate the task.json file, modify it as follows:

How to write c program with vscodeIf An error occurred: process terminated, exit code: 1, it may be that gcc has not been loaded by the editor (test method: open the console, enter gcc, and see the prompt message), just restart the editor.

Recommended tutorial:

vscode tutorial

The above is the detailed content of How to write c program with vscode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn