LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-19-2011, 08:26 AM   #1
sidrox93
LQ Newbie
 
Registered: Mar 2011
Location: India
Posts: 5

Rep: Reputation: 0
Installing GCC on Debian Squeeze


Hey Guys
I'm a total Linux noob using Debian Squeeze 6.0.1a (on Virtualbox). I'm a C/C++ Programmer and i need to write, compile and execute programs. I've heard gcc is good for this. But for the life of me i can't figure out how to download and install it.
Please help guys. I'm not familiar with any of the Linux Commands and i have no prior Linux experience. A step by step instruction list would be much appreciated.
Please help guys.
 
Old 05-19-2011, 08:57 AM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
Code:
apt-get install build-essential
http://linuxcommand.org/
 
Old 05-19-2011, 09:04 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
A little bit of explanation:
Most Linux distributions (including Debian) handle the installation of software different than Windows does it. The distributions have repositories that contain software packages (in case of Debian more than 30.000). The installation is handled by the distros package-manager ( in Debians case dpkg). It downloads the package and all necessary dependencies (software that is required to run the desired software) and installs them for you. It also handles updates in a simple way.
For Debian there are several front-ends to the dpkg package-manager, for example apt-get and aptitude for the command-line and Synaptic and the Software Center for the GUI. MTK358's suggestion is using the apt-get front-end.
 
Old 05-21-2011, 04:20 AM   #4
sidrox93
LQ Newbie
 
Registered: Mar 2011
Location: India
Posts: 5

Original Poster
Rep: Reputation: 0
Hey Guys
Still no luck When i do wat MTK358 told me it says "Unable to locate package build-essential"
Wat does dat mean ??? Oh... And Tobi i've tried doing dat... I type GCC in the quick search bar but
i don't get anything 2 install... All the search results are already checked... Wat do i do ???
 
Old 05-21-2011, 05:24 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Please post the contents of the file /etc/apt/sources.list. Seems to me that your repositories are not setup correctly.
 
Old 05-21-2011, 06:31 AM   #6
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
In addition to what Tobi said, maybe you should attach a screenshot. I am not sure but I *think* my Debian squeeze came with gcc installed. In case you are searching for GCC in the Application menu then you should know that gcc does not come with a GUI. It is a command line tool. Are you actually looking for an IDE?
 
Old 05-21-2011, 07:19 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
I had to install both g++-4.4 and g++ on a defaulted installation of Squeeze from the DVD .iso before building from source.

Commands used (could probably have been combined):
Code:
aptitude install g++-4.4
aptitude install g++
 
Old 05-21-2011, 08:37 AM   #8
sidrox93
LQ Newbie
 
Registered: Mar 2011
Location: India
Posts: 5

Original Poster
Rep: Reputation: 0
"# deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official i386 DVD Binary-1 2011
0322-15:11]/ squeeze contrib main

# deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official i386 DVD Binary-1 2011
0322-15:11]/ squeeze contrib main

deb http://security.debian.org/ squeeze/updates main contrib
deb-src http://security.debian.org/ squeeze/updates main contrib

# squeeze-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://ftp.debian.org/debian/ squeeze-updates main contrib
# deb-src http://ftp.debian.org/debian/ squeeze-updates main contrib
"

This is everything from the file u asked 4... I don't get wat is written in it... Plz help guys
@crts Actually yeah... Not exactly an ide... But how do i compile programs with the Gcc ?
 
Old 05-21-2011, 08:52 AM   #9
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
Quote:
Originally Posted by sidrox93 View Post
This is everything from the file u asked 4... I don't get wat is written in it... Plz help guys
@crts Actually yeah... Not exactly an ide... But how do i compile programs with the Gcc ?
First of all, it's "you", "for", and "Please".

Anyway, this is how you use GCC:

Code:
gcc -o executable_name source1.c source2.c source3.c
Give GCC only the source files, not the header files. Also, if you leave out the "-o executable_name" part, it will name the executable "a.out".

Or if you want to separately compile each file and then link them:

Code:
gcc -c source1.c
gcc -c source2.c
gcc -c source3.c
gcc -o executable_name source1.o source2.o source3.o
Of cource GCC has many more options you can use, but this is what you need to get started.

Last edited by MTK358; 05-21-2011 at 08:55 AM.
 
Old 05-21-2011, 08:58 AM   #10
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Quote:
Originally Posted by sidrox93 View Post
This is everything from the file u asked 4... I don't get wat is written in it... Plz help guys
@crts Actually yeah... Not exactly an ide... But how do i compile programs with the Gcc ?
Well, as catkin said, he had to install g++ separately, but I still *think* that gcc is installed by default (again, not 100% sure about that).
Open a terminal and type
Code:
gcc --version
If your output looks like
Code:
gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 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.
then see MTK's post on how to use gcc.
 
Old 05-21-2011, 09:36 AM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
You have only the security updates in your repositories list. Uncomment the last two entries (means remove the # in front of them) and run
Code:
apt-get update
You have to be root to do both, editing and updating.
Now you should be able to run
Code:
apt-get install build-essential
without errors.
 
Old 05-21-2011, 10:05 AM   #12
sidrox93
LQ Newbie
 
Registered: Mar 2011
Location: India
Posts: 5

Original Poster
Rep: Reputation: 0
Ok... I uncommented those entries...
After i executed
Code:
 apt-get update
i got a lot of text saying it downloaded something...
After that i typed
Code:
 apt-get install build-essential
it still says "build-essential" missing
 
Old 05-21-2011, 10:59 AM   #13
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Sorry, i was somewhat blind. Add these two lines to that file:
Code:
deb http://ftp.debian.org/debian/ squeeze main 
deb-src http://ftp.debian.org/debian/ squeeze main
The squeeze-updates repository i adviced to uncomment are the backports repository, which contain some newer software but aren't so well tested as the stable repositories. If you comment them out is up to you.
After adding the lines do the update again, now installation of build-essential should work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Installing thinderbird on Debian squeeze, missing libraries SkyerSK Linux - Software 8 01-30-2014 02:48 PM
Trouble Installing Debian Squeeze Using Netinst Bradj47 Linux - Desktop 1 04-01-2011 09:54 PM
Installing Debian Squeeze with Logitech EX100 KEJP Linux - Hardware 4 11-09-2010 07:50 AM
Installing Debian Squeeze on a 1201n 108134865 Debian 18 08-11-2010 05:59 PM
[SOLVED] Installing Eclipse on Debian Squeeze nima0102 Debian 9 12-14-2009 12:01 PM


All times are GMT -5. The time now is 09:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration