How to Install gcc in Windows

Sometimes it’s cool to use Open Source tools while developing something .Generally beginners in C or C++ use Borland Turbo C / C++ IDE (a.k.a. Turbo C/C++) but there are better options available. If you are just starting up with programming (or even you are pro),  GNU Compiler Collection (GCC) would the best choice as it is Free, OpenSource, not like Visual C. In most Linux flavors GCC is pre-installed but in Windows we have to install it manually and to do so just follow this simple steps!

 


Ad

STEP 1:  Open this link and download the executable file. (This is just a custom GCC port for windows)

Now just open it , follow the instructions and install it. (Default install location will be C:\cygnus)

Now compiler has been installed and now time for PATH the compiler so that we can use compiler in Command Line (CMD)


STEP 2:  Go to Control Panel -> System -> Advanced System Setting -> Environment Variable

Find for PATH in “System Variable” , open it and add “C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\;” [without quotes] followed by a semicolon ( ; ) [ THIS PATH MAY VARY ACCORDING TO THE LOCATION WHERE YOU INSTALLED THAT EXE FILE][.(Don’t change anything else – that may cause system failure)

Doing this will enable you to execute all the EXEs(including gcc.exe and g++.exe) present in that BIN folder from anywhere in CMD. And Now you are Done!

STEP 3: Time to test the compiler!

Open Run ( Windows + R )- type CMD – hit enter OR simply open CMD from start menu! Type gcc and if they will show  “NO INPUT FILES”, congrats!!! You have successfully installed compiler (Its huge achievement for a noob 😛 )!

Now you can compile source code by simply typing gcc <filename>.c OR g++ <filename>.cpp and the output of the source code a.exe will  be generated in the same folder. (Make sure your source code is present in the same address where cmd.exe is pointing to.)

 

If you want to use MinGW (a very popular GCC port for Windows) the process is quite similar just download MinGW, select packages you want, download them and add ~\bin folder to the system PATH. Why we did we use a custom port ? because it is smaller and  more portable than the MinGW.

STUFF A GeeK -> DEVELOPER MIGHT LIKE

NOTEPAD++  – Instead of using Notepad – try notepad++ . I really loved it  notepad plus plus

 

DEV C++ -Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it’s compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

 

 

NetBeans NetBeans is an integrated development environment (IDE) for developing primarily with Java, but also with other languages like PHP, C/C++, and HTML5.

 

EclipseEclipse is a multi-language Integrated development environment (IDE) in which you can work with including Ada, C, C++, COBOL, Fortran, Haskell, JavaScript, Perl, PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy, Scheme, and Erlang by adding some plugins!

 

Ad

One thought on “How to Install gcc in Windows”

Leave a Reply