Results 1 to 4 of 4
Hi,
I posted this in the newbie forum earlier, but this might be a more appropriate forum for it.
I've just installed gcc 3.3.2, but when I do "gcc -v" ...
- 07-08-2004 #1Just Joined!
- Join Date
- Jul 2004
- Posts
- 94
Changing the Default C Compiler
Hi,
I posted this in the newbie forum earlier, but this might be a more appropriate forum for it.
I've just installed gcc 3.3.2, but when I do "gcc -v" I still get "gcc 2.96." How do I set gcc3 as the default C compiler on my system?
Thanks for your help.
*****
I've searched Google quite a bit to find an answer. A long time ago I saw something like "export CC=$CC:/usr/local/bin/gcc3" as a way to export the new compiler as the default, but after I export, I still get "gcc 2.96" when I run "gcc -v."
- 07-08-2004 #2Linux Newbie
- Join Date
- May 2004
- Location
- Boston, MA
- Posts
- 246
I think the command /usr/bin/gcc is just a symlink to /usr/bin/gcc-x.xx. I know it is on my system; to see if it is on yours, just use
If it is a symlink, the output should be something likeCode:file /usr/bin/gcc
If this is the case, just change the target of the link withCode:/usr/bin/gcc: symbolic link to `/usr/bin/gcc-2.96'
Good luck!Code:ln -sf /usr/bin/gcc-3.3.2 /usr/bin/gcc
Situations arise because of the weather,
And no kinds of love are better than others.
- 07-08-2004 #3Just Joined!
- Join Date
- Jul 2004
- Posts
- 94
Hi Goran,
Here's what I get when I do that:
So it appears that mine is not a symlink.Code:$ file /usr/bin/gcc /usr/bin/gcc: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), stripped $
I just have to keep searching for an answer, I guess.
- 07-08-2004 #4Linux Newbie
- Join Date
- May 2004
- Location
- Boston, MA
- Posts
- 246
What programs do you have in /usr/bin/ that start with gcc? I.e., what's the output of
If you see both gcc-3.3.2 and gcc-2.96, then maybe your /usr/bin/gcc file is a hard link. RunCode:find /usr/bin | grep gcc
to find out: if it says Links: 2, then this is probably the case, and you should do as follows (otherwise I'm out of ideas, but maybe someone else on the forum can help):Code:stat /usr/bin/gcc
Just in case this doesn't work, make a backup copy of /usr/bin/gcc at ~/gcc.backup or something. Then simply remove /usr/bin/gcc and then runNow the command gcc should point to gcc-3.3.2. If it didn't work, remove the link and copy your backup file back to /usr/bin/gcc. And that's all I can think of.Code:ln -s /usr/bin/gcc-3.3.2 /usr/bin/gcc


Reply With Quote
