- Download and install Visual Studio Code
- Setup MinGW for C/C++
- Check MinGW Installation
- Set Up VS Code Extensions for C/C++
- Test Your Final Setup
- Go to the Visual Studio Code website.
- Click on the "Download" button for your operating system (Windows, macOS, or Linux).
- Once the download is complete, run the installer.
- Follow the on-screen instructions to complete the installation.
-
Download the MinGW Zip Archive
- Visit the Google Drive link for MinGW and download the MinGW zip archive.
-
Run the Setup Script
- Download the
setup_mingw.bat
script from this direct download link. - Place the
setup_mingw.bat
script in the same directory as the downloaded MinGW zip file (C:/
). - Double-click
setup_mingw.bat
to execute it. This script will extract the MinGW zip file, move the contents toC:/mingw
, and add thebin
directory to your system PATH.
- Download the
-
Open Command Prompt
- Search for Command Prompt (
cmd
) in the Start menu and open it.
- Search for Command Prompt (
-
Verify GCC Installation
-
Type the following command and press
Enter
to check if MinGW is installed correctly:gcc --version
-
Confirmation: You should see output displaying the version of GCC (GNU Compiler Collection). For example:
gcc (MinGW.org GCC-6.3.0-1) 6.3.0
-
If you see this output, it confirms that GCC is correctly installed and added to your system PATH.
-
-
Troubleshooting
- If the commands are not recognized, ensure that:
- You have saved and run the setup script properly.
- You may need to restart Command Prompt or your computer for changes to take effect.
- If the commands are not recognized, ensure that:
These extensions will help you easily compile and run your C programs, as well as provide a range of tools and functionalities for C development.
-
Install the C/C++ Compile Run Extension
-
Open Visual Studio Code.
-
Go to the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window or by pressing
Ctrl+Shift+X
. -
Search for "C/C++ Compile Run". The search results should look like the screenshot below:
-
Click on the "C/C++ Compile Run" extension by danielpinto8zz6, and then click Install. The installation process should be similar to the screenshot below:
-
Once the extension is installed, you may need to configure its settings. To do this, open the extension settings by navigating to:
-
In the extension's settings, find and check the option labeled:
-
-
Install the C/C++ Extension Pack
-
Create a New C File
- Open Visual Studio Code.
- Go to File > New File.
- Save the new file with a
.c
extension, for example:hello.c
.
-
Write a Simple C Program
-
Enter the following code into your
hello.c
file:#include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }
-
-
Compile and Run the C Program
Following these steps ensures that your C development environment is set up correctly and allows you to start programming in C with Visual Studio Code.