Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-13-2012, 02:14 AM   #1
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Rep: Reputation: Disabled
How can I switch between g++ 4.5 4.6 4.7 versions in Debian Squeeze? (6.0.5)

Debian comes with 4 preinstalled version of g++ from 4.4 to 4.7.

What do I have to do to choose which version of g++ will be the default compiler in console when i
?g++ -std=gnu++0x -lpthread code.cpp -o ExeFile

P.S. for Moderators
1.Until when Im allowed to use this newbie forum? post 50 maybe?

2.As you may have noticed, I start different threads even when a new question diverges just a bit from the thread title I've strated even if its still the same topic.
I do this for SEO purposes of the forum and think its the desired way also. If not you may inform.

Last edited by esgol; 07-13-2012 at 02:17 AM.
Old 07-13-2012, 02:58 AM   #2
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,516

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Examples using the non default compilers
( default = /usr/bin/ gcc g++ ) :

1. gcc-4.4 hello.c -o hello

2. export CC=gcc-4.4 CXX=g++-4.4 && <other-command>,
like : export CC=gcc-4.4 CXX=g++-4.4 && ./configure && make

3. CC=gcc-4.4 CXX=g++-4.4 cmake ../

Also : The default compiler can be changed :
# update-alternatives --config gcc
.... If you then choose e.g. version 4.7, the links in /usr/bin/
will be set to point to gcc-4.7 / g++-4.7 .


Last edited by knudfl; 07-13-2012 at 03:08 AM.
1 members found this post helpful.
Old 07-13-2012, 03:35 AM   #3
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
so simple as i immagined. I also had cought somewhere thatupdate alternatives command and was supposing it would have something to do. thank you


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
LXer: How to add Debian Squeeze to your Debian Lenny FAI install server LXer Syndicated Linux News 0 09-08-2011 07:21 PM
Various segmentation faults Debian Squeeze Virtualbox running on Debian Squeeze host fordwrench Debian 1 07-21-2011 03:55 AM
Should I switch to apt-get after upgrading to Squeeze? Deerslayer Debian 7 05-01-2011 01:37 AM
LXer: How To Upgrade Debian Lenny (Debian 5.0) To Squeeze (Debian 6.0) On Xen VPS LXer Syndicated Linux News 0 03-09-2011 05:20 AM
How to switch java versions... markw8500 Programming 3 09-24-2006 06:54 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:52 PM.

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