How To Set Up Visual Studio Code For C Programming
1. Introduction
Visual Studio Code (VS Code) is a free and powerfull source-code editor made by Microsoft for Windows, macOS and Linux
It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C, C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).
In this tutorial you will learn how to set up VS code on your local environment for C and C++.
2. Requirement
- MinGW
- Homepage : http://www.mingw.org/
- Download : http://sourceforge.net/projects/mingw/
- Tutorial : https://www.dndsandyra.web.id/2021/10/how-to-install-mingw-on-windows.html
- Visual Studio Code (VS Code)
- Homepage : https://code.visualstudio.com/
- Download : https://code.visualstudio.com/#alt-downloads
3. Install VS Code extensions
- Open VS Code, Go to Start Menu > All Apps > Visual Studio Code > Visual Studio Code.
- Select the “Extensions view icon” on the Activity bar, or click on the File menu, select Preferences > Extensions.
- Install “C/C++” extension
- Search for “C++”.
- Click
the “Install” button to install the extension.
- Install “Code Runner” extension
- Search for “Code Runner”.
- Click
the “Install” button to install the extension.
- Now we have successfully installed code editor.
4. Install a compiler (MinGW)
Please visit the tutorial at : https://www.dndsandyra.web.id/2021/10/how-to-install-mingw-on-windows.html
5. Create C Program
To make sure the compiler is installed and configured correctly, we'll create the simplest C program.
- Click on the File menu, click on Add
Folder to Workspace.
- Browse your C workspace (folder), navigate to
save workspace (folder) (ex: D:\Program\VSCode\).
- Now create a new file called “hello.c”
with the “New File” button in the File Explorer, or click on the File
menu > click on New File.
- Write and save your first C program. Press "Ctrl+S" to save. Ex :
6. Compile and run C program in VS Code
Once you created your first C program it's time to compile and run your program.
- Select the “Run code icon” on the Editor Area,
or Right click > click on Run Code.
- You should see the output "Hello, DnD!".
Thanks for reading!
No comments
Pembaca yang baik selalu meninggalkan komentar sesudah membaca ^_^
Terimakasih sudah mengisi komentar