Atheel Massalha
Atheel Massalha

Reputation: 464

How to use atomic header c++

Im trying to compile a c++ file that includes atomic headr,

I am getting this error:

#error <atomic> is not supported on this single threaded system

Im using cross compiled clang. Im running on redHat 6.9

Upvotes: 0

Views: 920

Answers (1)

TypeIA
TypeIA

Reputation: 17248

This error means that libcxx for the target system was configured without threading support. The documentation for libcxx outlines its threading support.

_LIBCPP_HAS_NO_THREADS

This macro is defined when libc++ is built without threading support. It should not be manually defined by the user.

The error you're getting means that _LIBCPP_HAS_NO_THREADS is defined. Specifically, from the atomic header:

#ifdef _LIBCPP_HAS_NO_THREADS
#error <atomic> is not supported on this single threaded system
#endif

You will need to find out if you can build/configure libcxx for your target platform with threading support as outlined in the libcxx documentation.

Upvotes: 5

Related Questions