Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
C compiler in Linux

Reply  
Thread Tools
chatterjee's Avatar
Computer Specs
Senior Member with 591 posts.
 
Join Date: Jul 2005
Location: IIT Kharagpur,India
Experience: Intermediate
23-Jul-2007, 02:57 PM #1
C compiler in Linux
I heard that Linux has a very good C compiler named gcc.But in my newly installed Ubuntu 7.04 I can't find it,though it is shown in synaptic that it is installed.How can I open it?

Is there any other good C compiler for Ubuntu?Please suggest one.

NB:My question may seem to be stupid one,but I'm a complete newbie to Linux.
__________________
“This life is short, the vanities of the world are transient, but they alone live who lives for others, the rest are more dead than alive.” .......Swami Vivekananda
briealeida's Avatar
Computer Specs
Senior Member with 677 posts.
 
Join Date: Jun 2007
Location: US and A
Experience: Ninja
23-Jul-2007, 04:15 PM #2
To install it the command is 'apt-get build-essential'.

(Obviously, this installs more than the compiler.)
jsize466's Avatar
Computer Specs
Junior Member with 22 posts.
 
Join Date: May 2007
Location: Louisville, KY
Experience: Advanced
23-Jul-2007, 04:23 PM #3
Smile sudo apt-get install build
What you need to do is start up a terminal and run:
1. sudo apt-get install build-essential
2. put in your root password
3. tell the install yes

The compiler is gcc and it is great (thanks to RTS) . This will also give you the g++ compiler (C++).

I hope that helps
chatterjee's Avatar
Computer Specs
Senior Member with 591 posts.
 
Join Date: Jul 2005
Location: IIT Kharagpur,India
Experience: Intermediate
24-Jul-2007, 03:32 AM #4
Executed the command.But where is gcc.How to open the compiler?
InterKnight's Avatar
Member with 333 posts.
 
Join Date: Oct 2004
Location: California
Experience: Advanced
24-Jul-2007, 03:46 AM #5
There are two ways, essentially, to access the compiler.

The first is to use the terminal (Applications->Accessories->Terminal):
----To learn about using gcc in the terminal, run the command:

Code:
man gcc
or to learn about using g++ via the terminal, run the previous, replacing gcc with g++.

The second way is to use a GUI IDE for programming, such as Code::Blocks Studio. They have Ubuntu (.deb) nightly build packages here.

Note that some nightly releases do not yet have a deb package available. Before installing the package, however, you'll need to follow this tutorial.

I've used Code::Blocks for over two years now; it works quite well.

Hope this helps.

Take care.
__________________
"No matter how hard things may seem, you are never trapped until you stop trying."
International Association of Visually Impaired Technologiests (IAVIT)TLDPTLCLFree CompTIA Certification Training VideosBashGuide
chatterjee's Avatar
Computer Specs
Senior Member with 591 posts.
 
Join Date: Jul 2005
Location: IIT Kharagpur,India
Experience: Intermediate
24-Jul-2007, 04:10 AM #6
But how to open the compiler?
Attached Thumbnails
C compiler in Linux-screenshot-sayan-ubuntu-sayan-.png  
InterKnight's Avatar
Member with 333 posts.
 
Join Date: Oct 2004
Location: California
Experience: Advanced
25-Jul-2007, 02:19 AM #7
Basically, as far as I know, you cannot "open (per se) the compiler. You coudl access its capabilities via an Integrated Development Environment (IDE) like Code::Blocks, or you could create a text file with yoru code in it and save it with a .cpp extension (for C++) or a .c extension (for C), then run either gcc or g++ via the command line with various parameters to compile the file.

I've really never used the compiler via the command line; I've always used it via a GUI program such as Code::Blocks.
__________________
"No matter how hard things may seem, you are never trapped until you stop trying."
International Association of Visually Impaired Technologiests (IAVIT)TLDPTLCLFree CompTIA Certification Training VideosBashGuide
briealeida's Avatar
Computer Specs
Senior Member with 677 posts.
 
Join Date: Jun 2007
Location: US and A
Experience: Ninja
25-Jul-2007, 09:07 AM #8
Reread what InterKnight said.

What do you feel you need to open it for?
You can install a front end to it but it natively doesn't have one.
The website for the compiler is http://gcc.gnu.org

This may be your pace, too: http://en.wikipedia.org/wiki/GNU_Compiler_Collection
__________________
--
Brie Aleida
http://unixsysadmin.org
lotuseclat79's Avatar
Distinguished Member with 21,345 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
25-Jul-2007, 11:12 AM #9
If you have Synaptic Package Manager accessible from the System->Administration pull-down menu, use it to install gcc after checking the appropriate blocks. You will get only what is needed for gcc and g++ and libraries to work, and it will tell you the files involved in the installation from a .list file in the directory, /var/lib/dpkg/info with gcc in the name of the .list file after you have installed it using the Synaptic Package Manager. I can't emphasize enough that the use of Synaptic is the preferred way to get any updates rather than using the Update Manager for your system. I only use the Check function of the Update Manager and NOT the Install function because you get too many unneeded other packages installed that are not necessarily needed that it may not tell you about.

As for opening gcc, it is invoked via command line terminal:
$ gcc file.c
or
$ g++ file.cc

-- Tom

P.S. I am not aware of a graphical IDE environment for gcc or g++ although there may be an excellent one available. I started my career as a compiler jock in software engineering, so using a command line environment is second nature to me - i.e. usually better control, unless I find the right environment in my travels around the web.

P.P.S. If anyone knows of an excellent gcc/g++ Frontend graphical environment for compiling, creating code, and debugging with gdb - post a link here!
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction
between a mere artisan or specialist and a real seeker after truth. - Einstein 1944
Imagination is more important than knowledge. - Einstein
InterKnight's Avatar
Member with 333 posts.
 
Join Date: Oct 2004
Location: California
Experience: Advanced
25-Jul-2007, 01:35 PM #10
lotuseclat79,

I actually never learned to use the command-line compiler when I was in college; it always seemed so esoteric to me until I started using Linux.

For a really good front-end, however, please see my post (#5) on this thread. Code::Blocks (in my op0inion) is a great application available for multiple operating systems, and it's open source. It can make use of GDB as well as GCC (on its initial startup it scans for any present compilers).

While I was in college a couple years back, we had to use Micro$oft Visual C++, but I couldn't afford it for my homework assignments. I found Code::Blocks and used it ever since.

There was another one around called Dev-C++, but ti appears (to me) to be out of development except for a branch of it at sourceforge. The problem with it was that it was only for Windows.

Hope this info helps.

Take care.
__________________
"No matter how hard things may seem, you are never trapped until you stop trying."
International Association of Visually Impaired Technologiests (IAVIT)TLDPTLCLFree CompTIA Certification Training VideosBashGuide
chatterjee's Avatar
Computer Specs
Senior Member with 591 posts.
 
Join Date: Jul 2005
Location: IIT Kharagpur,India
Experience: Intermediate
25-Jul-2007, 01:36 PM #11
Thank you all for your help.
By "opening compiler" I tried to say that I cannot open the IDE.Actually I was used to type programs in Turbo C IDE in Windows and wanted to see a similar one in Linux.
InterKnight's Avatar
Member with 333 posts.
 
Join Date: Oct 2004
Location: California
Experience: Advanced
25-Jul-2007, 03:21 PM #12
chatterjee,

I know that there are other C/C++ IDEs for Linux (I'm pretty sure), but the main one I now of is Code::Blocks.

I just did a bit of research for you on this one. Here are a few IDEs:

Anjunta IDE--I've never used this one, but you can get it through Synaptic in Ubuntu.

Eclipse (with eclipse C/C++ Development Tools (CDT))--you can get this from Synaptic in Ubuntu. The packages are named [b]eclipse]/b] and eclipse-cdt.

Code::Blocks Studio (if you'd go with this option, please see post #5. I wouldn't go with the 1.0RC2 release as it's quite outdated. The MingW Developer Studio (from what I saw, this has not been updated for about two years)

Hope this may be of some help to you.

Take care.
__________________
"No matter how hard things may seem, you are never trapped until you stop trying."
International Association of Visually Impaired Technologiests (IAVIT)TLDPTLCLFree CompTIA Certification Training VideosBashGuide
chatterjee's Avatar
Computer Specs
Senior Member with 591 posts.
 
Join Date: Jul 2005
Location: IIT Kharagpur,India
Experience: Intermediate
26-Jul-2007, 03:24 AM #13
Thank you very much InterKnight
InterKnight's Avatar
Member with 333 posts.
 
Join Date: Oct 2004
Location: California
Experience: Advanced
26-Jul-2007, 05:03 AM #14
No problem. Just glad to be of assistance.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:01 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.