PDA

View Full Version : How to run C and C++ applications?



Abhishek Sinha19850130
November 12th, 2008, 09:43 PM
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.

prshah
November 12th, 2008, 10:45 PM
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.

Abhishek Sinha19850130
March 19th, 2009, 10:32 PM
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!!

luckydeveloper
April 30th, 2009, 01:38 PM
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

Kushal Sejwal
May 5th, 2009, 12:11 PM
The first thing is to install compilers as pointed out in last post, simply fire the following command in the terminal:

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.

sudo apt-get install geany

firen
August 2nd, 2009, 11:33 AM
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.

mrman208
March 29th, 2010, 10:31 PM
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.

toji
July 13th, 2010, 02:58 PM
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!!

shyguy1188
August 18th, 2010, 11:57 AM
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. ;)

tushar maroo
March 11th, 2011, 08:19 PM
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