在 CentOS 上设置默认 g++?

5 defaults version centos g++

我正在尝试将默认的 g++ 设置为 4.7.2,我的主机告诉我已经安装了(我还被告知还安装了 c++11);然而,我们都不知道如何将默认的 g++ 设置为 4.7.2 因为g++ --version给出

g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)

sudo在这里尝试了这些命令,但我发现它们不起作用,因为 CentOS 使用yum.

如何在 CentOS 5.9 上将默认 g++ 设置为 4.7.2(如果它甚至已安装)?

sch*_*iba 1

您需要设置CXX环境变​​量。例如,export CXX="/usr/bin/g++-4.7"。而CC就是控制C编译器的。