GCC for Windows


As everyone knows, MS Visual C++/ Visual Studio compiler, linker, builder error & warning reports are way too difficult to understand & debug. So I was searching for a GCC/G++ compiler for windows & found “MinGW” – “Minimalist GNU for Windows”. It is THE GCC/G++ for windows.
Tested OK. Works exactly like the GCC for linux… using the command prompt of windows as the terminal.

In addition, DevC++ is a GUI version of MinGW, which implies it uses GCC/G++. Its IDE helps to build, organise & handle bigger projects.

1. Download MinGW

2. When you run this installer, it’ll ask for –

  • Download & install or
  • Download only
  • Go for “Download only”.
    Approx 74MB of data will be downloaded.

    3. After download, run the installer again & this time select “Download & install”.
    It’ll ask for the packages you want like g++, java compiler, ada compiler etc. Select the required & proceed.

    4. Now, you need to add this MinGW to system path. For this, goto
    My Computer-> Right click-> Properties-> Advanced tab-> Environmental Variables-> System Variables
    Select “Path” -> Edit
    Then add the folder where MinGW is extracted. Suppose it is the default C:\MinGW, then add
    C:\MinGW\bin
    at the end. OK & close.

    Your MinGW is installed & ready to use.

    5. To compile a C/C++ file, open Command prompt & cd to the folder where the .c or .cpp file is stored. then type:

    (for C file)

    gcc filename.c -o output_filename.exe


    (for C++ file)

    g++ filename.cpp -o output_filename.exe

    If -o output_filename.exe is not used then it’ll create a default “a.exe” file in that folder.
    6. Run the exe. That’s it.

    For any further doubts, refer to MinGW documentation.

    Advertisements

    11 responses to “GCC for Windows

    1. I tried this,
      thanx for information

      but i m getting problem while opening the exe file
      m unable to see the out puts.When I open output( the exe )file it closes automatically after running the programme & it happens so fast tht i even can’t see the output.

      please help

    What do you think??

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s