Xcode 12.5 - include <atomic> fails

I am using #include <atomic> in my DriverKit extension c++ file.

This compiled correctly with older versions of Xcode, but starting with Xcode 12.5 (and beta 13) the compiler can no longer find some required types.

For example:

In file included from /Applications/Xcode-12.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/atomic:571:
In file included from /Applications/Xcode-12.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__threading_support:14:
In file included from /Applications/Xcode-12.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/chrono:827:
/Applications/Xcode-12.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ctime:57:9: error: no member named 'clock_t' in the global namespace; did you mean 'clockid_t'?
using ::clock_t;

There are various other missing definitions, time_t, tm, clock, difftime, time, asctime, ctime, gmtime, localtime and strtime, none of which I am trying to use.

I assume that there was a change in the default include paths, but can't see what it is.

Suggestions would be welcome! Thanks!

Replies

I have verified that creating a new DriverKit project in Xcode 12.5, adding a single .cpp file, with a single #include , fails to build with the same errors.

This worked in previous Xcode versions (version 11, and version 12.4).

You can use the atomic operations from #include <stdatomic.h>. We had to move to this from #include <atomic>, which was slightly annoying.