我想使用c ++ 14功能,所以我想使用GCC 6.3编译器。我已经完成了here找到的命令列表
之后,我创建了一个新工具包,并使用了新安装的xg ++编译器here's the compiler description并在我的.pro CONFIG += c++11 c++14
中添加了以下内容。
编译器仍然无法识别strings / cout / endl,也无法使用auto进行自动返回类型扣除。此外,无法识别二进制文字。
我在这里缺少什么?
事实证明,Qt Creator中的一个错误是不通过在工具包中提供其路径来切换到使用给定的编译器。但是,我从终端执行了以下步骤:
// Update & Build Essentials & add ppa of the gcc & update again
$ sudo apt-get update
$ sudo apt-get install build-essential software-properties-common -y
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y // ppa of gcc 6.3
$ sudo apt-get update
$ sudo apt-get install gcc-snapshot -y
$ sudo apt-get update
// Install the gcc and Add the gcc as an alternative
$ sudo apt-get install gcc-6 g++-6 -y
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
// You can switch the gcc verions via
$ sudo update-alternatives --config gcc
并替代了我现有的海湾合作委员会。一旦我恢复了Qt创建器的默认套件并将默认GCC设置为6.3而不是4.8,我就可以轻松运行C ++ 14功能,前提是CONFIG += c++14
在.pro中。