Search Flipkart

Wednesday, July 13, 2011

Using gcc for newComer

GCC is one if the best compiler for C language . It has regualar upadates and patches .
GCC can be found preinstalled in almost all LINUX distros.
GCC can be installed on windows as standalone and also through Cygwin..
How to use GCC.
let you have a source code file named source.c and you want executable to be named as outpt then
the command will be
gcc -o outpt source.c
this will compile source.c and will create a exectuable as outpt
to see the output the command will be

for more details use the man page
man gcc
Those who are moving from TurboC to GCC remember the following:-
1. Its a gcc compiler please take care of it{please come out of Turbo C}
2. Don't try to include "conio.h" and "dos.h"
3. Don't write void main().....only main() or int main() will work
4. The executable generated will work only in Linux{any distro}
5. Don't write getch()
6. For textual support from book use the book from K & R {The C programming language}

Notes for C++ :::
1. Its a g++ compiler
2. Don't try to write "#include < iostream.h > instead write these two lines:::
#include< iostream>
using namespace std;
3. Don't write void main ...
only int main() will work and then u have to write "return 0 ; " in main's body

1 comment: