Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

An example of vscode creating a C language project

Shulou Source: shulou.com Published: 2022-06-02 16:07:27 09月23日 Update

This article mainly introduces vscode to create a C language project example, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

1. Download the plug-ins Cmax Candle + and C++ Intellisense.

2. Create a new empty folder and open it from VSCode. (or File-- > Open Folder-- > create an empty folder)

3. Press F5 (use the command line gcc or make; to write a makefile file, and select C++ (GDB/LLDB) to generate launch.json (for debugging).

4. Modify the launch.json to set the

"program": "enter program name, for example ${workspaceFolder} / a.out"

Change to

"program": "${workspaceFolder} / ProjectName"; "externalConsole": true

Indicates that the output will be on the pop-up command line. If you change it to false, the output will be terminal inside VSCode.

5. Ctrl+Shift+B, select tasks.json-- > template-- > other to generate tasks.json (create task)

6. Modify tasks.json

"command": "echo Hello"

Change to

"command": "Gmail +-o ProjectName ProjectName.cpp"

The ProjectName here has the same name as the ProjectName in 5

7. For complex projects, "command": "echo Hello" is changed to "command": "make"

8. Create the makefile file and edit it

9. Write Hello.cpp files

10. Press Ctrl+Shift+P, select Task:Run Tasks, and execute the task

11. Press F5 to execute

The source code is as follows:

Hello.cpp

# include using namespace std;int main () {cout

Tags: Files articles projects selections examples languages tasks commands folders Clippers build output complexity value interests at the same time plug-ins more friends templates Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL macOS Apple OPPO Reno