Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have compiled the latest GCC 4.7.0, on my Linux Mint 12, using gcc 4.6.1 (default).
Compiler compiled successfully, steps followed

  1. ./configure
  2. make
  3. make install

Binaries of gcc-4.7.0 are in /usr/local/bin/ after install step.

Now the goal is to make the new compiler the default while also keeping the old one around(no uninstall) i.e. I want to be able to do gcc a.c or g++ a.cpp directly in the terminal window.
I have been unable to find a proper series of steps that would help me accomplish this.

Also, doing /usr/local/bin/g++ hello-world.cpp generates iostream file/directory not found.

Any help is appreciated.

share|improve this question
Copy-paste the exact commands you ran and the exact error messages. – Gilles Mar 25 '12 at 22:52
@Gilles: The exact commands : 1) ./configure 2)make 3)make install Put /usr/local/bin in PATH in .bashrc. Now I run g++ -v and I get version 4.7.0 but gcc -v gets version 4.6.1 and also following are the contents apt c++ cpp g++ gcc -- directory that contains xgcc(binary) gcc-ar gcc-nm gcc-ranlib gcov highlight i686-pc-linux-gnu-c++ i686-pc-linux-gnu-g++ i686-pc-linux-gnu-gcc-ar i686-pc-linux-gnu-gcc-nm i686-pc-linux-gnu-gcc-ranlib mint-md5sum search /usr/local/bin/g++ a.cpp , generates the error message that iostream file/directory not found, compilation aborted. – AquaAsh Mar 26 '12 at 15:15
Edit your question, please, with formatting (check the preview below the edit box to see if it looks readable). In a comment, with no newlines, this is very hard to read. – Gilles Mar 26 '12 at 16:51
The exact commands : 1. ./configure 2. make 3. make install 4. Put /usr/local/bin in PATH in .bashrc. 5. Now I run g++ -v and I get version 4.7.0 but gcc -v gets version 4.6.1. /usr/local/bin/ contents 1. apt 2. c++ 3. cpp 4. g++ 5. gcc -- directory xgcc(binary) 6. gcc-ar gcc-nm 7. gcc-ranlib 8. gcov 9. highlight 10. i686-pc-linux-gnu-c++ 11. i686-pc-linux-gnu-g++ 12. i686-pc-linux-gnu-gcc-ar 13. i686-pc-linux-gnu-gcc-nm 14. i686-pc-linux-gnu-gcc-ranlib 15. mint-md5sum search – AquaAsh Mar 26 '12 at 17:55
Really embarrassed and sorry, I tried using <ol>,</ol>,<br> and what not but I don't seem to be getting it right. – AquaAsh Mar 26 '12 at 18:05

AFAIK Mint is from Debian family, so likely gcc is installed in separate packages and /usr/bin/gcc is only symlink. Even if you don't package gcc-4.7 properly you can install it into designated path (e.g. /opt/gcc47) and then change symlink set (gcc, cpp, g++) to point to your installed version.

Don't install gcc-4.7 into standard paths like /usr/local/bin without reversing symlinks in /usr/bin. Some tools can drop PATH or rewrite it so result will be unpredictable.

You can add option -v to gcc command line to ask printing of commands and searching process to detect which binaries are really called and what is incorrect.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.