Qt 5.1 Beta错误使用std :: atomic c ++ 11功能 [英] Qt 5.1 Beta Error using std::atomic c++11 feature

查看:898
本文介绍了Qt 5.1 Beta错误使用std :: atomic c ++ 11功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用QT,仍然熟悉编译过程。目前,我试图将一个现有的QT项目移植到Mac。这个程序在Linux和Windows上编译和运行。

I have just started to work with QT and am still getting familiar with the compilation process. Currently, I am trying to port an existing QT project to Mac. This app compiles and runs on Linux and Windows.

当我在Mac OSX 10.8.2上编译项目时,我得到这个c ++ 11相关的错误, p>

When I compile the project on Mac OSX 10.8.2 , I am getting this c++11 related error ,

#include ../xxx/pch.h:71:10: fatal error: 'atomic' file not found
#include <atomic>
^
1 error generated.
make[1]: *** [debug/xxx/objective-c++.pch] Error 1
make: *** [debug] Error 2
11:32:01: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project xxx (kit: Qt5.1.0)
When executing step 'Make'

我在.pro文件中加入了以下标志来启用c ++ 11,

I have included the below flags in the.pro file to enable c++11 ,

QMAKE_CXXFLAGS += -std=c++11

CONFIG += c++11

我使用预构建的QT5.1Beta包(Clang)构建项目,我相信已经启用了c ++ 11.

I am building the project with the pre-built QT5.1Beta package (Clang) which I believe has c++11 enabled.

我看到以下位置的原子标头
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/atomic
和in / usr / lib / c ++ / v1 / atomic

I see the atomic header in the below locations /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/atomic and in /usr/lib/c++/v1/atomic

我试过测试包括完整的路径
/Applications/Xcode.app/Contents /Developer/Toolchains/XcodeDefault.xctoolchain/usr//lib/c ++ / v1 / atomic

I tried testing by including the complete path , /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr//lib/c++/v1/atomic

我得到以下错误,

In file included from ../xxx/pch.h:71:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/atomic:535:2: 
error: atomic is not implemented

In file included from ../xxx/pch.h:124:
../../../yyy.h:308:12: error: no type named 'atomic' in namespace 'std'
std::atomic<bool> m_signaled;

我在这里缺少什么?

推荐答案

添加

macx:QMAKE_CXXFLAGS += -stdlib=libc++
macx:QMAKE_LFLAGS += -stdlib=libc++

这篇关于Qt 5.1 Beta错误使用std :: atomic c ++ 11功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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