user2423772
user2423772

Reputation: 186

Qt 5.1 Beta Error using std::atomic c++11 feature

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.

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'

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

QMAKE_CXXFLAGS += -std=c++11

CONFIG += c++11

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

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

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

I am getting the below error,

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;

What am I missing here?

Upvotes: 3

Views: 3316

Answers (2)

Joan P.S
Joan P.S

Reputation: 1573

Maybe it is a bit late, but I fixed it using the -std=gnu++0x flag

Upvotes: -1

Sergey Shambir
Sergey Shambir

Reputation: 1602

Add also

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

Upvotes: 2

Related Questions