Wednesday, December 14, 2011

How to Install/Run GCC compiler in Windows Command Prompt

        How many times do you switch between Windows and Linux just to get the benefit of your favourite compiler?? Now that was the main headache I always had because no other compiler seemed to satisfy me. So  I searched and finally got a solution which I would readily share with you all.

There are few simple steps which you need to follow and then you are done. No more switching unnecessarily between the OS. So here goes the steps :

Step 1 :
Goto the site www.mingw.org and at the left side menu Navigation-->Downloads. In the directed page click on Download mingw-get-inst-20111118.exe (591.9 kB). Download the file and run.

Step 2 :
While installing mingw just follow the steps and finally you will see the command prompt popping up downloading the respected files. This will take some time. Finally click on finish.

Step 3:
This finishes your job. Only one more step and you are done. Goto Control Panel-->System-->Advanced-->Environment Variables.



Step 4:
Find the variable "PATH" and click on Edit. Here give the path of the bin file in MinGW


Step 5 :
This completes you work. Restart your system and you are ready to use GCC in windows.

Commands for compilation :

To compile your file: 

gcc filename.c   OR  g++ filename.cpp

To run your file :

Just type the .exe file name on the command line and hit Enter.

Hope you could get through the process. In case of any queries just feel free to ask questions and I will try by best to solve them. And don't forget to share if you like it. Happy Programming.. :)

3 comments:

  1. great tutorial. The vim color scheme that you’re using, could you please share?
    mobile prices in Pakistan

    ReplyDelete