Results 1 to 10 of 10

Thread: How to run C and C++ applications?

  1. #1
    Join Date
    Jul 2008
    Location
    Pune
    Beans
    3
    Distro
    Ubuntu 8.10 Intrepid Ibex

    How to run C and C++ applications?

    I would like to run these applications on my Ubuntu. I use hardy heron. Is there a specific compiler for it.

    Looking forward to responses.

  2. #2
    Join Date
    Oct 2007
    Location
    Chennai, India
    Beans
    3,804
    Distro
    Ubuntu Development Release

    Re: How to run C and C++ applications?

    Quote Originally Posted by Abhishek Sinha19850130 View Post
    I would like to run these applications on my Ubuntu. I use hardy heron. Is there a specific compiler for it.
    You don't need a compiler to _run_ applications; they will run just fine as native binary apps.

    That said, if you want to write your own programs and then compile them, you can use g++, the c / c++ compiler included with your Ubuntu distribution.
    Cheers,PRShah
    Make your own: Ubuntu, Kubuntu, Xubuntu, Mythbuntu All-in-One Live DVD
    "I never make mistakes; I thought I did, once.. but I was wrong."

  3. #3
    Join Date
    Jul 2008
    Location
    Pune
    Beans
    3
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: How to run C and C++ applications?

    HEllo PRShah,

    I am really sorry for this late reply. Thanks for your reply. But how should i start programming in C, write programs, compile them and see them in the output? DO i have to use terminal for it. Usuall for windows we start in borland!!

  4. #4
    Join Date
    Aug 2008
    Location
    india
    Beans
    240
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to run C and C++ applications?

    If you want to do C/C++ programming,

    1. you need to type your programs in an editor such as emacs, vim etc
    2. And then compile them using a compiler

    To install a compiler,go to terminal and type
    sudo apt-get install build-essential

    To install emacs, go to terminal and type
    sudo apt-get install emacs22

    After these are over, go to terminal, start emacs, type your program in it and compile using the command
    gcc <filename.c>
    and then type
    ./a.out
    to run your program...

    For more, refer https://help.ubuntu.com/8.04/programming/C/index.html

  5. #5
    Join Date
    Jun 2008
    Beans
    8

    Re: How to run C and C++ applications?

    The first thing is to install compilers as pointed out in last post, simply fire the following command in the terminal:
    Code:
    sudo apt-get install build-essential
    Now instead of using commands each time to compile, build and run. You simply install an IDE(Borland/TC in windows) like Geany to do the stuff for you.
    Code:
    sudo apt-get install geany

  6. #6
    Join Date
    Aug 2009
    Location
    Noida, India
    Beans
    21
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: How to run C and C++ applications?

    If using terminal haunts you, use gedit ( Applications > Accessories> Text Editor ) it has all good syntax highlighting and stuff for programmers. If you want to keep yourself completely away from terminal, try IDEs such as KDevelop, for Gnome look at Anjuta.

  7. #7
    Join Date
    Mar 2010
    Beans
    3

    Smile Re: How to run C and C++ applications?

    Quote Originally Posted by firen View Post
    If using terminal haunts you, use gedit ( Applications > Accessories> Text Editor ) it has all good syntax highlighting and stuff for programmers. If you want to keep yourself completely away from terminal, try IDEs such as KDevelop, for Gnome look at Anjuta.
    I would suggest using the Eclipse IDE with CDT for C/C++ development, but you can use whatever you want.

  8. #8
    Join Date
    Aug 2009
    Location
    Chandigarh, India
    Beans
    16
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: How to run C and C++ applications?

    Hey you should also try code blocks IDE.
    but i really think you should use vim. once you get a hang of the command line it's really fun!!

  9. #9
    Join Date
    Aug 2010
    Beans
    1

    Exclamation Re: How to run C and C++ applications?

    try writing your code in GEDIT(application->accessories->gedit)....

    write your code there.. save it....

    open TERMINAL(application->accessories->terminal)

    commands are:=>

    gcc -v <your file name>.<c>


    use g++ instead of gcc for <c++> programs. u'll get errors with the line no written beside them... it's really easy and fun..

    you can also find the help by typing

    man gcc in terminal.

  10. #10
    Join Date
    Jul 2010
    Location
    Jaipur
    Beans
    51
    Distro
    Ubuntu 12.04 Precise Pangolin

    Talking Re: How to run C and C++ applications?

    if you are at a very basic step then i recommend you to go for gcc(for C) and g++(for C++)
    type in terminal:-
    command line for compiling c-program:
    gcc filename.c
    then for run it type:-
    ./a.out

    similarly for cpp programs
    g++ filename.cpp
    and then for running
    ./a.out
    please mark the thread solved if your problem is solved...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •