Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I came into my classrom Debian is installed, and gcc 4.1. I want to install (compile from sources is an option - I have time..) for my self GCC 4.7 and adress it in bash as gcc anywhere. Is such thing possible and how to do it?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Use the --prefix option with the configure command.

I won't try to give a complete configure command here, since GCC is one of those programs most often given complex configuration options, but adding something like --prefix=$HOME/my-gcc-4.7 will work. Upon installation, you will get a tree under that directory containing things like bin/gcc.

Once it's built and installed, add $HOME/my-gcc-4.7/bin to the head of your PATH, and suddenly it will become the default GCC.

share|improve this answer
add comment

Your Answer

 
discard

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.