Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Because I cannot compile some code by gcc/g++ 4.7, I want to install gcc/g++ 4.4.

I searched the Internet and found some different way. I don't know what is the best solution.

Is it possible to choose what version I want to use without make a "gcc" link again?

share|improve this question

Just install the gcc-4.4 Install gcc-4.4 and g++-4.4 Install g++-4.4 packages and make sure you call the right compiler version on the command line, e.g.

g++-4.4 [options]

Depending on the source you are trying to compile, you can usually specify the compiler in the Makefile.

You might want to switch the default compiler on your system by telling Ubuntu this using update-alternatives, e.g.

update-alternatives --config cc
update-alternatives --config c++

Note that this is a system-wide setting, so I would not recommend doing this unless compiling this source is the only purpose of this system.

share|improve this answer

You may find that you need additional libs while trying to compile different applications. So if you're doing anything beyond your own, relatively simple, applications I would suggest install the build-essential package instead of just the standalone compile.

With that in mind, if you're doing the compiling manually then specify it directly on the command line, if however you're using a Makefile, then you can set the CC and CXX variables

export CC="gcc-3.4"
export CXX="g++-3.4"
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.