undefined reference ___atomic_is_lock_free with Xcode 8.2.1

Viewed 295

I am running a code like this on Mac:

    #include <atomic>
    #include <iostream>
    #include <utility>
    #include <atomic>

    struct A { int a[100]; };
    struct B { int x, y; };
    int main()
    {
        std::cout << std::boolalpha
        << "std::atomic<A> is lock free? "
        << std::atomic<A>{}.is_lock_free() << '\n'
        << "std::atomic<B> is lock free? "
        << std::atomic<B>{}.is_lock_free() << '\n';
    }

the error message is : Undefined symbols for architecture x86_64: "___atomic_is_lock_free", referenced from: _main in testassembly.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

is_lock_free is part of c++ standard library, seem strange to me. do you have any idea about this?

0 Answers
Related