C Compilation using gcc

best c / c++ compiler

Searching for best C compiler for compilation?? You must have to stop searching here. gcc/g++: Gross compiler for C /C++ is the best compiler for execution or compilation of c/c++ code. To search best c/c++ compiler  is still depends on your, need and platform + operating system you are working on.
GCC Gross compiler work on all platforms from windows –> mac OS –> Linux to your android phone, thats why I am calling it Best Compiler for C/C++.. This post is about compilation and execution of your code using gcc on windows and unix/linux based operating system.

SEE ALSO : Run your code on Android

Compilation on Linux/Unix based Operating System using best c / c++ compiler


Steps for compilation using gcc/g++ compiler:
best c / c++ compiler
  1. GCC is a pre installed compiler in most of the Linux/Unix based O.S , check via: gcc –version or g++ –version.
  2. If it is not already installed , install it using apt-get command
    sudo  apt-get install gcc
    sudo apt-get install g++
  3. Write your code using any text editor for example : vi-editor or g-edit (Don’t use #include andgetch())   and save it as buffercode.c or buffercode.cpp .
  4. Open your terminal and type
       gcc -o output buffercode.c
    or   g++ -o output buffercode.cpp
  5. Now run your program on terminal using
      ./output
  6. All is done 😉

Compilation on Windows using gcc/g++

  1. Download Mingw and install it by double click on exe file.
  2. Set Environment variable/path for compilation using your cmd.
    go to C drive(Or where it is installed) –>MINGW –>bin and copy it’s path
  3. Open Control Panel –> System –> environment variables(on the left side) –> path
    paste their your copied path.
  4. Write your code using Notepad or Notepad++ and save it as buffercode.c or buffercode.cpp (Don’t use#include and getch())
  5. Open your cmd
    Press Window(button) + R and type cmd in run
  6. Go to your file directory using cd command where your c program is saved.
    mine is D://program/buffercode.c
    cd d:
    cd program
  7. Open your terminal and type
    gcc -o output buffercode.c
    or   g++ -o output buffercode.cpp
  8. Now run your program on terminal using
    ./output
  9. All is done 😉

Compilation using CodeBlock

  1. Install gcc using above steps either on linux or windows.
  2. Install codeblock and integrate it .with gcc.
  3. Write your code ,compile it and execute it.
You can use gcc with several other softwares and applications. Even you can run your code on your android device too using your best C/C++ compiler , off-course it is gcc.
Window users can also go with VS(Visual studio )
Learn C-Programming with buffercode click here to start .