I know that very few compilers actually support C11 threads (which is sad, but whatever). The C11 standard demands that an implementation that doesn't support threads defines __STDC_NO_THREADS__
. Yet this program seems to give an error:
#include <stdio.h>#ifndef __STDC_NO_THREADS__ #include <threads.h> //error is here#endif // __STDC_NO_THREADS__int main(void){ #ifdef __STDC_NO_THREADS__ printf("There are no threads"); #else printf("There are threads"); #endif // __STDC_NO_THREADS__}//Error at line 3: fatal error: threads.h: No such file or directory
Compiler version is GCC 9.2.0 (Windows 10 x64), with __STDC_VERSION__
= 201710L
(so it is C17). If you cannot tell, the problem is that my compiler doesn't define either __STDC_NO_THREADS__
or <threads.h>
, which doesn't conform to C11. What could the problem be?