- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
๐ How to Compile and Run C Programs in VS Code (with Code Runner)
Want to write and run C code easily using Visual Studio Code? In this blog, I'll walk you through the full process step-by-step — from setting up your compiler to configuring VS Code for smooth execution.
๐น Watch the Full Tutorial on YouTube:
๐ Step-by-Step Setup Process:
- Download and install MinGW from the official SourceForge page:
๐ https://sourceforge.net/projects/mingw/ - Add
binfolder (usuallyC:\MinGW\bin) to your system's PATH environment variable. - Install the Code Runner extension by Jun Han in VS Code.
- Open your VS Code
settings.jsonand add the following code:
"code-runner.executorMap": {
"c": "cd $dir; gcc $fileName -o $fileNameWithoutExt; if ($?) { .\\$fileNameWithoutExt.exe }"
}
This configuration tells Code Runner to compile your C file and execute it automatically using GCC.
๐งช For Manual Compilation (Optional):
If you prefer compiling manually via terminal, use the following commands:
gcc ".\01_first.c" -o main
.\main.exe
✅ You're all set!
Now you can create any .c file in VS Code, and run it using either the Code Runner "Run" button or your terminal. Happy coding! ๐
๐ฑ Stay Connected:
- ๐ Facebook: Click Here
- ๐ LinkedIn: Click Here
- ๐ Facebook Group: Join the Group
- Get link
- X
- Other Apps
Comments
Post a Comment