I am trying to change the C++ compiler version. I have both, 4.6.x AND 4.4 versions, I want to set it to the 4.4 version, so I am doing:
export "CXX=g++-4.4"
But when I run the command:
g++ -v
I am still getting this:
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
I am using Ubuntu 14.04.
I am using this tutorial:
https://stackoverflow.com/questions/7832892/how-to-change-the-default-gcc-compiler-in-ubuntu
The
CXX
variable doesn't affect how the shell resolves program nameg++
: that just follows the usual conventions of your executable search path$PATH
, and is finally determined by a symbolic link e.g. on my 14.04 systemwhile
If you want to change that, you will need to re-make the symbolic link either manually e.g.
or using the update-alternatives mechanism.
However, many build processes will respect the setting of
CXX
(and the equivalentCC
for the C compiler,FC
for the Fortran compiler and so on) so that there is often no need to change the default compiler(s) via symlinks: if there is a particular software build that you are having difficulty with then I suggest you post a question about that specifically.