I still remember my high school days when Turbo C used to be the primary IDE for running C program. However, over the past years, it’s working on Windows PC is somewhat a hit or miss. I myself tried to make it work on Windows 10, but no luck. Anyways, who needs an IDE when you have the power of Command line tools. Though Windows Command Line Tool is not as powerful as of OS X and Linux, it’s good enough to Compile and Run C Program. All you need is a Notepad, cmd and a GCC compiler. Over the next few minutes, I’ll let you know the easiest way to Compile and Run C Program in Windows 10 Using Command Prompt.
While GCC is a part of OS X command line tools and some distro of Linux have GCC pre-installed, Windows is not blessed with it. So the very first step in to install GCC in Windows. Let’s see how to make it work. How to Install GCC Compiler in Windows 10: Step 1: Head over to and look out for executable Codeblocks mingw setup. MinGW is a GCC compiler which is bundled with Code::Blocks. Also, it is the easiest way to get GCC on Windows and will save you from all the hardship required to compile C program. Step 2: Once the download has finished, run the executable file and install it on your PC.
Also note the directory where you have installed Code::Blocks. By default, it’ll get installed in Program Files(x86). Installation task is done, let’s see how to setup GCC Compiler in Windows. How to Setup GCC Compiler in Windows: Step 1: Head over to This PC (My Computer) - Enter your System Drive (For me, it’s C Drive) - Program Files(x86) - CodeBlocks - MinGW - bin - Copy the drive address. The path variable has been set.
Let’s see how to Compile and Run C Program in Windows 10. Compile and Run C Program in Windows 10: Step 1: Open Notepad and write a test C program of your choice. Save the program with an extension of.c. For instance, if you have decided to name your program as Test, save it as Test.c. Step 2: Launch Command Prompt and point it where your program has been saved. Okay, I’ll let you know how to do this. Example 1: If the saved program is on your Desktop.
How To Download Gcc For Cygwin
How To Download Gcc In Linux Terminal
On the Command Prompt Window, type cd Desktop and hit enter. Example 2: If you have created a folder named c-programs on Desktop and this is the folder where all your programs and it’s executables will lie, just type cd Desktop - Enter and cd c-programs - Enter. Step 3: Once you are done with Step 2, type gcc -o test test.c on Command Prompt Windows and hit Enter. In general, it’s like gcc -o NameOfYourProgram NameOfYourProgram.c This is how you gonna Compile C program in Windows 10.
How To Download Gcc For Windows
If there are any errors, it’ll show up there on Command Prompt window. Step 4: Now, head over to the folder where all your Programs lie. You’ll see the executable of your new compiled program. Double click on it and this how you gonna Run C Program in Windows.
So we have successfully Installed GCC, set up GCC, Compiled your newly written C program and subsequently ran it in Windows 10. I hope by this time you have clear knowledge how to compile and run a C program in Windows. If this guide helped you in any way, don’t forget to give us a +1. Also, if you have any issues following the guide, let us know. We’ll get back to you asap.
Meanwhile, you can also like us on or follow us on. There’s a lot gonna happen out there in coming days.