如何使用C ++ 14支持从源代码构建Qt 5 [英] How to build Qt 5 from source with c++14 support

查看:159
本文介绍了如何使用C ++ 14支持从源代码构建Qt 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用-std = c ++ 14标志为gcc4.9从git中构建Qt 5.4.1。但是我不确定如何将标志正确地传递到构建过程中。

I am attempting to build Qt 5.4.1 pulled from git with the -std=c++14 flag for gcc4.9. But I am not sure about how to properly pass the flag into the build process.

我已经阅读到将CONFIG + = c ++ 14添加到qt项目文件中应该会从Qt5.4开始工作,所以我将其添加到位于顶部文件夹的qt.pro中。

I have read that adding CONFIG += c++14 to a qt project file should work since Qt5.4, so I have added it into the qt.pro located in the top folder.

但是Qt仍使用-std = c ++ 0x进行编译(c ++ 11)。

But Qt is still compiled with -std=c++0x (c++11).

推荐答案

如果使用 g ++ clang ++ 来构建 Qt 5 ,然后转到 qt5 / qtbase / mkspecs / common / g ++-base.conf qt5 / qtbase / mkspecs / common / clang.conf 并更改 QMAKE_CXXFLAGS_CXX11 = -std = c ++ 11 的右侧分配给(例如) -std = gnu ++ 1z (或分配给您所需的任何内容)。

If you using g++ or clang++ to build the Qt 5, then go to qt5/qtbase/mkspecs/common/g++-base.conf or qt5/qtbase/mkspecs/common/clang.conf respectively and simply change the right hand side of QMAKE_CXXFLAGS_CXX11 = -std=c++11 assignment to (for example) -std=gnu++1z (or to whatever you need).

到构建 Qt 5 ,您必须使用 -c ++ 11 运行 qt5 / configure 脚本提供的(以及 -platform linux-clang-libc ++ linux-clang linux-g ++ 或您需要的任何内容-pa rameter是 qt / qtbase / mkspecs / * / 代表您的平台的目录名称。

To build Qt 5 you have to run qt5/configure script with -c++11 provided (and -platform linux-clang-libc++ or linux-clang or linux-g++ or whatever you need — the parameter is the qt/qtbase/mkspecs/*/ directory name represented your platform).

这篇关于如何使用C ++ 14支持从源代码构建Qt 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆