Namespaces
Variants
Views
Actions

Talk:cpp/memory/shared ptr/atomic

From cppreference.com
  1. include <atomic>
   shared_ptr<ClassType> ptr (new ClassType);
   atomic<shared_ptr<ClassType>> ptr2;
   atomic_store(&ptr2, ptr);
   auto ptr3 = atomic_load (&ptr2);        

singleton.cpp:(.text+0x7f1): undefined reference to `__atomic_store_16' singleton.cpp:(.text+0x808): undefined reference to `__atomic_load_16'

Is there anybody here have idea about how to fix this compile error?

Sounds like you're using gcc and missing the -latomic commandline switch. --Cubbi (talk) 23:13, 10 January 2015 (PST)