compiler linux(ubuntu)

Hello. I have just got Ubuntu Installed on my computer and i want to get a compiler on it as well.
It seems o much harder to install a compiler on it thoe. Ive been trying for 7 hours and i cant do it.
Anyone who knows a good compiler for a Neewbie in the programming world?
Some info on how to install it would be nice to! :)
Last edited on
It may have one, I can't remember if the basic Ubuntu package comes with it or not

just open a terminal window and type which gcc
If you have one installed already, it will tell you where it is. If not it will say can't find it in, and list a load of directories.

If you haven't got it, open the synaptic package manager off the system menu and look for gcc. You will also need the header file package as well
Last edited on
Yes i had it in /usr/bin/
I have 4 different files there gcc, gcc-4.1, gccbug-4.1 and gccmakedep

I cant open any of them,
As u notice im a real neewbie so please could u tell me step by step how i can get a working compiler so i can start learning how to program :)
If you are expecting an IDE (pretty windows where you can edit code and the like) GCC doesn't do that. It is just a compiler.

You might want to install a nice IDE package. Suggested IDEs are:



(You'll need KDE components installed to use this one. It shouldn't affect your Gnome setup.)

Personally, I tend to use plain-text editors for everything. Those I like:

(Extensive syntax highlighting support and I can make it use WordStar key commands.)

Kate (formerly KEdit)

vim ;-)
[edit] If you can't escape, type
and press ENTER.[/edit]

(You've probably already got this installed.)

I hate emacs, but a lot of people love it. You've probably already got this installed too.
If you can't escape, press Ctrl-X Ctrl-C.

Hope this helps.

[edit] Oh yeah, almost forgot. You can run the GCC by opening the command prompt, changing to the directory where your program is, say /prog/myapp.cpp, and typing

g++ -Wall -pedantic -o myapp myapp.cpp

What that means is "start g++, give all warnings, be strict about language standards, output to 'myapp' (instead of 'a.out') and the source file(s) is 'myapp.cpp'."
Last edited on
Okey but when u compile the files uing the text editor how do u do then?
And i think i would be happy with getting the gcc to work. But i dont relly folow how u mean that i should do.
Whats the command prompt?
the gcc files are in:
Select Applications menu, accessories, terminal window. what you see is the command prompt. Use cd to change directory to the directory where your files are. you can use the command gcc (C compiler) or g++ (C++ compiler) from any directory. The which command shows that gcc's location is known so you don't need to worry about that.
Duoas's commands should work OK.

Use the command man followed by the command to look up the help pages e.g. man gcc for how to use gcc.
i think an ide would work better for you
it does for me
but some people prefer text editors
i use code::blocks, and it works great with the gcc compiler
no weird commands.
by the way, you may want to type sudo apt-get install build-essential if you had to download gcc.
it will give you all the packages you need to compile programs from source.
and also, it will make sure you have all the packages you need for compiling code from an ide.
@Douas: You missed out Pico :(

Also, Anjuta is a Dev-C++ like C++ IDE for Linux. It tries to fill the gap on the *nix platform. It's pretty easy to get and use.

Netbeans is another.

+1 for Eclipse though.
IDE/editors I dislike more than Emacs don't get listed... ;-)
Il happy to tell u that im using Emacs + gcc atm ;) And i like emacs! :D Ita relly hackerish :P :P:P
So you got the GCC working for you? (At least sufficient that you can compile C++ programs?)

Emacs is a great editor. I just can't stand the way it works since I've been pre-programmed (or brainwashed, as you will) by WordStar. The first time I ever used Emacs I think I nearly wiped my hard-drive and crashed my system trying to escape it. :-S
Yeh it works fine now! :) g++ hello.cpp -o hello :)
What whould u suggest i use insted of emacs?
Happy to try every thing!:)
Use what you like. There's nothing wrong with Emacs. I just don't like it. *sheepish grin*

I use my Delphi 5.0 IDE to edit everything. Someday I'll finish my own code editor...
Topic archived. No new replies allowed.