Qt 5.0和c ++ 11与OSX山狮 [英] Qt 5.0 and c++11 with OSX Mountain Lion

查看:171
本文介绍了Qt 5.0和c ++ 11与OSX山狮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在离开7年后再次尝试c ++。我已经下载了新发布的Qt 5.0 sdk的osx,但我不能得到一个基本的c ++ 11功能编译使用Qt Creator。以下语句:

I'm giving c++ a try again after being away for 7 years. I've downloaded the newly released Qt 5.0 sdk for osx, but I can't get a basic c++11 feature compiled using Qt Creator. The following statement:

auto i = 3;

会导致编译错误:

mainwindow.cpp:19: error: ISO C++ forbids declaration of 'i' with no type

我有google的类似问题,并发现建议放置

I've google around for similar problems and found suggestions to put

QMAKE_CXXFLAGS += -std=c++11
  or
CONFIG += c++11

.pro文件。很遗憾没有成功。构建在无法识别的命令行选项上失败。

in the .pro file. Unfortunately without success .The build fails on unrecognized command line options.

我必须做错事。有什么建议么?

I must be doing something wrong. Any suggestions?

感谢,

Frans

推荐答案

它看起来像Qt Creator Mac的错误。
我使用

It's looks like Qt Creator for Mac bug. I fixed it using

QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7
LIBS += -stdlib=libc++ -mmacosx-version-min=10.7

在.pro文件中

这篇关于Qt 5.0和c ++ 11与OSX山狮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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