it doesn't seem to have the threads.h
header, though it isn't complaining
C11 has 2 specs about __STDC_NO_THREADS__
7.26 Threads
Implementations that define the macro __STDC_NO_THREADS__
need not provide
this header nor support any of its facilities. C11 N1570 §7.26.1 2
__STDC_NO_THREADS__
The integer constant 1, intended to indicate that the
implementation does not support the <threads.h>
header. C11 N1570 §6.10.8.3 1
Per §7.26.1 2:
#ifdef __STDC_NO_THREADS__
#error "No threading support"
#else
#include <threads.h>
#endif
Per §6.10.8.3:
#if defined(__STDC_NO_THREADS) && __STDC_NO_THREADS__ == 1
#error "No threading support"
#else
#include <threads.h>
#endif
// Certainly this can be simplified to
#if defined(__STDC_NO_THREADS) && __STDC_NO_THREADS__
or per What is the value of an undefined constant used in #if? to
#if __STDC_NO_THREADS__
This matches OP's code, so I would have expected that to work with a compliant C11 compiler.
Yet it looks like OP has a solution per @Kevin. That may be a false solution as __STDC_NO_THREADS
looks like a typo (missing trailing __
).
#if !defined(__STDC_NO_THREADS) || __STDC_NO_THREADS__
threads.h
file. – Robert Harveythreads.h
is actually in there, and if it is, see if the compiler has access to it. – Robert Harveyfind /Applications/Xcode.app/Contents -name threads.h
– Grady Player#if !defined(__STDC_NO_THREADS) || __STDC_NO_THREADS__
– Kevin