1

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?

1

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.

| improve this answer | |
0

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"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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