running c++ program in linux

Discussion in 'Open Source' started by shivi4, Jan 30, 2006.

Thread Status:
Not open for further replies.
  1. shivi4

    shivi4 New Member

    Joined:
    Oct 4, 2004
    Messages:
    162
    Likes Received:
    0
    Trophy Points:
    0
    i am very new to linux

    using ubuntu os

    i know only turbo c++ programs i want to run turbo c++
    program in linux gnu

    how do i know whether i have gnu software in my linux
     
  2. Satissh S

    Satissh S New Member

    Joined:
    Mar 23, 2005
    Messages:
    692
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Chennai , India
    We have gnu compiler collection in GNU\Linux. Gcc is one of the most robust c compilers in the world. You can use it in place of turboc or if you need an IDE, use Anjuta. Use synaptic to install anjuta and start using it.
     
  3. vignesh

    vignesh New Member

    Joined:
    Jul 20, 2004
    Messages:
    1,658
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    Gcc is the compiler present in Linux...Install it using synaptic ...

    Just select build-essential packages it will install gcc also...
     
  4. OP
    OP
    shivi4

    shivi4 New Member

    Joined:
    Oct 4, 2004
    Messages:
    162
    Likes Received:
    0
    Trophy Points:
    0
    how to detect gcc in linux

    and how to install
    i dont know how to install in linux
     
  5. vignesh

    vignesh New Member

    Joined:
    Jul 20, 2004
    Messages:
    1,658
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    Open synaptic and install it by selecting on gcc....Search for it in synaptic if you can`t find it.
     
  6. naveenchandran

    naveenchandran New Member

    Joined:
    May 16, 2004
    Messages:
    451
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    ** Hosur ** Operating System:GNU
    Open terminal and type "gcc" and press enter to see if it is installed, if it says command not found then it might not be installed.

    gcc <filename>
    eg: gcc shiv.c
     
  7. Satissh S

    Satissh S New Member

    Joined:
    Mar 23, 2005
    Messages:
    692
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Chennai , India
    also give
    $gcc --version
    to get the version, since it's ubuntu 5.10 it might be 3.4 :roll: Just a guess.
     
  8. OP
    OP
    shivi4

    shivi4 New Member

    Joined:
    Oct 4, 2004
    Messages:
    162
    Likes Received:
    0
    Trophy Points:
    0
    what is synaptic how to install that
     
  9. OP
    OP
    shivi4

    shivi4 New Member

    Joined:
    Oct 4, 2004
    Messages:
    162
    Likes Received:
    0
    Trophy Points:
    0
    i am getting this
    which guess i have gcc
    but how to run c+ file
    in the terminal

    gcc (GCC) 3.3.4 (Debian 1:3.3.4-9ubuntu5)
    Copyright (C) 2003 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     
  10. desertwind

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    btw, he asked for a c++ compiler. gcc is gnu c compiler. try th following for a cpp file

    g++ <filename.cpp>

    after successful compilation

    ./a.out

    for running the program
     
  11. OP
    OP
    shivi4

    shivi4 New Member

    Joined:
    Oct 4, 2004
    Messages:
    162
    Likes Received:
    0
    Trophy Points:
    0
    i am writing this program as demo
    #include<conio.h>
    #include<iostream.h>
    #include<stdio.h>
    using namespace std;
    int main()
    {
    cout<<"hello";
    return 0;
    }
     
  12. OP
    OP
    shivi4

    shivi4 New Member

    Joined:
    Oct 4, 2004
    Messages:
    162
    Likes Received:
    0
    Trophy Points:
    0
    ok how to use other header files in gcc
     
  13. vignesh

    vignesh New Member

    Joined:
    Jul 20, 2004
    Messages:
    1,658
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    conio.h is not present in gcc... What other header files do you want to use...
     
  14. praka123

    praka123 left this forum longback

    Joined:
    Sep 7, 2005
    Messages:
    7,513
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    -
    Borland' C/C++ compiler's a little different eg graphics.h etc is not a defacto thus not present in g++.Now many books for eg Cpp for Dummies etc cites examples been compiled on using gcc either in Windows OS or Linux.In windows some minimalist gnu...mingw32 etc should be installed.
     
Thread Status:
Not open for further replies.

Share This Page