LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I switch between g++ 4.5 4.6 4.7 versions in Debian Squeeze? (6.0.5) (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-switch-between-g-4-5-4-6-4-7-versions-in-debian-squeeze-6-0-5-a-4175416460/)

esgol 07-13-2012 02:14 AM

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

Quote:

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.


knudfl 07-13-2012 02:58 AM

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 .


.

esgol 07-13-2012 03:35 AM

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


All times are GMT -5. The time now is 08:17 PM.