为何Qt5不支持C++11

南窗客斯黄 2013-06-22 10:42:29
如题,我下载的一个Qt5为何不支持C++11新标准,就连其中最简单的Lambda表达式都不支持。官网上说的原话是:Additionally, if your compiler supports C++11 lambdas, you can even connect directly to a lambda function.
请问谁的Qt支持C++11,能告诉我怎么做的吗?
...全文
1301 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
neicole 2015-01-19
  • 打赏
  • 举报
回复
http://woboq.com/blog/cpp11-in-qt5.html MSVC does not require any special flags and enables the C++11 features by default, but GCC or Clang require -std=c++0x. By default, Qt5 itself will be compiled with the C++11 flags on compilers that need it. If you use qmake, you can add that line to your .pro file (Qt5): CONFIG += c++11 (In Qt4, it should be something like: gcc:CXXFLAGS += -std=c++0x) And now you can enjoy all the nice features of C++11. (It is already worth doing it only for being able to use auto) Update: Also check out the changes in C++14
huacai123057 2013-06-23
  • 打赏
  • 举报
回复
XChinux 论坛都快两个月了,还没有弄好?可错过不少啊
XChinux 2013-06-23
  • 打赏
  • 举报
回复
首先你使用的编译器要支持你要用的C++11 特性,其次,在.pro中加上 CONFIG += c++11
南窗客斯黄 2013-06-23
  • 打赏
  • 举报
回复
就是二楼的解决方案哦。谢谢啦。

16,203

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧