Home>Article>Development Tools> How to write c language in vscode

How to write c language in vscode

王林
王林 Original
2020-03-25 16:20:23 11638browse

How to write c language in vscode

Get C/C extension

Open vscode

ctrl shift x open store

Search for C /C

Install and restart vscode

How to write c language in vscode

Install GCC

Download MinGW

Open the installer and install to D disk (you need to create the MinGW folder). After the installation is completed, the MinGW installation manager will be generated.

The manager will open 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 language in 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 bin folder path of the installed MinGW into it.

How to write c language in vscode

Configure smart prompts

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

Edit c_cpp_properties.json

How to write c language in vscode##c_cpp_properties.json modification content is as follows:

How to write c language in vscode

Enable debugging

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

How to write c language in 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 language in vscodeIf an error occurs: 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 language in 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