clang c11 threads.h not found

3 Solutions Collect From Internet About “clang c11 threads.h not found”

Looks like almost nothing supports the threads feature in C11… maybe I will try to get it into clang…

With the clang on my machine (v. 3.2 on ubuntu/linux) that feature test macro isn’t defined. Support for that feature will need support in the C library, that usually doesn’t come with the compiler. So basically the answer for clang will not be much different than for gcc, they usually build upon the same C library, namely glibc, see here for answer for gcc.

In C++11, you want to #include <thread>, not threads.h

#include <iostream>
#include <thread>

void fun() { std::cout << "fun!" << std::endl; }

int main() {
    std::thread t ( fun );
    t.join ();
    return 0;