Having 2 versions of gcc
I have just installed gcc 4.7 from ppa repository. Ubuntu 12.04 already comes with 4.6. When I use command:
gcc --version
It tells me it is 4.6.3 to be exact.
I have no idea of how to launch the 4.7 compiler. In fact, I wouldn't mind erasing the former version and stay with 4.7 only (I guess that wouldn't be a problem).
How can I fix this?
gcc
add a comment |
I have just installed gcc 4.7 from ppa repository. Ubuntu 12.04 already comes with 4.6. When I use command:
gcc --version
It tells me it is 4.6.3 to be exact.
I have no idea of how to launch the 4.7 compiler. In fact, I wouldn't mind erasing the former version and stay with 4.7 only (I guess that wouldn't be a problem).
How can I fix this?
gcc
do you have synaptic on your system?!
– user61928
Sep 27 '12 at 8:40
If i uninstall gcc from synaptic, when I call gcc into console version 4.7 will show up? Just as easy as that?
– Roman Rdgz
Sep 27 '12 at 9:05
yes but you must check which version you are removing
– user61928
Sep 27 '12 at 9:08
you have to remove you oldgcc
firstsudo apt-get remove gcc*
then install the newer version
– blade19899
Sep 27 '12 at 10:10
add a comment |
I have just installed gcc 4.7 from ppa repository. Ubuntu 12.04 already comes with 4.6. When I use command:
gcc --version
It tells me it is 4.6.3 to be exact.
I have no idea of how to launch the 4.7 compiler. In fact, I wouldn't mind erasing the former version and stay with 4.7 only (I guess that wouldn't be a problem).
How can I fix this?
gcc
I have just installed gcc 4.7 from ppa repository. Ubuntu 12.04 already comes with 4.6. When I use command:
gcc --version
It tells me it is 4.6.3 to be exact.
I have no idea of how to launch the 4.7 compiler. In fact, I wouldn't mind erasing the former version and stay with 4.7 only (I guess that wouldn't be a problem).
How can I fix this?
gcc
gcc
asked Sep 27 '12 at 8:34
Roman RdgzRoman Rdgz
2591511
2591511
do you have synaptic on your system?!
– user61928
Sep 27 '12 at 8:40
If i uninstall gcc from synaptic, when I call gcc into console version 4.7 will show up? Just as easy as that?
– Roman Rdgz
Sep 27 '12 at 9:05
yes but you must check which version you are removing
– user61928
Sep 27 '12 at 9:08
you have to remove you oldgcc
firstsudo apt-get remove gcc*
then install the newer version
– blade19899
Sep 27 '12 at 10:10
add a comment |
do you have synaptic on your system?!
– user61928
Sep 27 '12 at 8:40
If i uninstall gcc from synaptic, when I call gcc into console version 4.7 will show up? Just as easy as that?
– Roman Rdgz
Sep 27 '12 at 9:05
yes but you must check which version you are removing
– user61928
Sep 27 '12 at 9:08
you have to remove you oldgcc
firstsudo apt-get remove gcc*
then install the newer version
– blade19899
Sep 27 '12 at 10:10
do you have synaptic on your system?!
– user61928
Sep 27 '12 at 8:40
do you have synaptic on your system?!
– user61928
Sep 27 '12 at 8:40
If i uninstall gcc from synaptic, when I call gcc into console version 4.7 will show up? Just as easy as that?
– Roman Rdgz
Sep 27 '12 at 9:05
If i uninstall gcc from synaptic, when I call gcc into console version 4.7 will show up? Just as easy as that?
– Roman Rdgz
Sep 27 '12 at 9:05
yes but you must check which version you are removing
– user61928
Sep 27 '12 at 9:08
yes but you must check which version you are removing
– user61928
Sep 27 '12 at 9:08
you have to remove you old
gcc
first sudo apt-get remove gcc*
then install the newer version– blade19899
Sep 27 '12 at 10:10
you have to remove you old
gcc
first sudo apt-get remove gcc*
then install the newer version– blade19899
Sep 27 '12 at 10:10
add a comment |
1 Answer
1
active
oldest
votes
Use update-alternatives
(from CLI) or galternatives
(from GUI) to set the default for gcc.
If you don't have them, install with: sudo apt-get install galternatives
.
I would use the GUI version, it is more simple for a beginner.
From CLI:
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/newer/gcc 40
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/older/gcc 30
sudo update-alternatives --config gcc
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
Roman: for this is made thealternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...
– Frantique
Sep 27 '12 at 13:25
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f193539%2fhaving-2-versions-of-gcc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use update-alternatives
(from CLI) or galternatives
(from GUI) to set the default for gcc.
If you don't have them, install with: sudo apt-get install galternatives
.
I would use the GUI version, it is more simple for a beginner.
From CLI:
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/newer/gcc 40
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/older/gcc 30
sudo update-alternatives --config gcc
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
Roman: for this is made thealternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...
– Frantique
Sep 27 '12 at 13:25
add a comment |
Use update-alternatives
(from CLI) or galternatives
(from GUI) to set the default for gcc.
If you don't have them, install with: sudo apt-get install galternatives
.
I would use the GUI version, it is more simple for a beginner.
From CLI:
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/newer/gcc 40
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/older/gcc 30
sudo update-alternatives --config gcc
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
Roman: for this is made thealternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...
– Frantique
Sep 27 '12 at 13:25
add a comment |
Use update-alternatives
(from CLI) or galternatives
(from GUI) to set the default for gcc.
If you don't have them, install with: sudo apt-get install galternatives
.
I would use the GUI version, it is more simple for a beginner.
From CLI:
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/newer/gcc 40
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/older/gcc 30
sudo update-alternatives --config gcc
Use update-alternatives
(from CLI) or galternatives
(from GUI) to set the default for gcc.
If you don't have them, install with: sudo apt-get install galternatives
.
I would use the GUI version, it is more simple for a beginner.
From CLI:
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/newer/gcc 40
sudo update-alternatives --install /usr/bin/gcc gcc /path/to/older/gcc 30
sudo update-alternatives --config gcc
edited Sep 27 '12 at 11:52
answered Sep 27 '12 at 9:53
FrantiqueFrantique
7,0972547
7,0972547
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
Roman: for this is made thealternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...
– Frantique
Sep 27 '12 at 13:25
add a comment |
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
Roman: for this is made thealternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...
– Frantique
Sep 27 '12 at 13:25
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
I have installed galternatives but I have no idea of what I should do with it. gcc is not listed among the list of alternatives. 'C++' is, for example, and if I click I see only one option, using /usr/bin/g++. But I don't know If adding a new option to the newer g++
– Roman Rdgz
Sep 27 '12 at 10:59
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
See the CLI commands. Customize them, to fit your needs.
– Frantique
Sep 27 '12 at 12:31
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
I have had a look at /usr/bin looking for the newer g++, and I found that I currently have gcc4.5, 4.6 and 4.7, and then there is a link to executable called gcc, which points to gcc-4.6. Same for g++. Wouldn't it be easier to modify this link from console (don't know how to) to point to 4.7, and leave everything else as it is?
– Roman Rdgz
Sep 27 '12 at 13:17
Roman: for this is made the
alternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...– Frantique
Sep 27 '12 at 13:25
Roman: for this is made the
alternatives
to not to modify anything in the filesystem. Try to read a little bit about it, it worths...– Frantique
Sep 27 '12 at 13:25
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f193539%2fhaving-2-versions-of-gcc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do you have synaptic on your system?!
– user61928
Sep 27 '12 at 8:40
If i uninstall gcc from synaptic, when I call gcc into console version 4.7 will show up? Just as easy as that?
– Roman Rdgz
Sep 27 '12 at 9:05
yes but you must check which version you are removing
– user61928
Sep 27 '12 at 9:08
you have to remove you old
gcc
firstsudo apt-get remove gcc*
then install the newer version– blade19899
Sep 27 '12 at 10:10