Неопределенная ссылка C++ на `__atomic_load_16' ⇐ C++
-
Гость
Неопределенная ссылка C++ на `__atomic_load_16'
I have linking errors, when trying to do an atomic load of a 16 byte block. I have the following code:
#include struct MyStruct{ long x; long y; }; struct X{ std::atomic myStruct; }; int main(){ X x; MyStruct s = atomic_load(&x.myStruct); } When I compile this with (g++ version 5.3.1):
g++ --std=c++11 test.cpp I get the error
/tmp/ccrvzLMq.o: In function `std::atomic::load(std::memory_order) const': test.cpp:(.text._ZNKSt6atomicI8MyStructE4loadESt12memory_order[_ZNKSt6atomicI8MyStructE4loadESt12memory_order]+0x1c): undefined reference to `__atomic_load_16' collect2: error: ld returned 1 exit status If (following a hint in another post) I add the "-latomic" flag, I get the error "/bin/ld: cannot find /usr/lib64/libatomic.so.1.1.0". And indeed that file does not exist.
Any suggestions?
Gavin
I have linking errors, when trying to do an atomic load of a 16 byte block. I have the following code:
#include struct MyStruct{ long x; long y; }; struct X{ std::atomic myStruct; }; int main(){ X x; MyStruct s = atomic_load(&x.myStruct); } When I compile this with (g++ version 5.3.1):
g++ --std=c++11 test.cpp I get the error
/tmp/ccrvzLMq.o: In function `std::atomic::load(std::memory_order) const': test.cpp:(.text._ZNKSt6atomicI8MyStructE4loadESt12memory_order[_ZNKSt6atomicI8MyStructE4loadESt12memory_order]+0x1c): undefined reference to `__atomic_load_16' collect2: error: ld returned 1 exit status If (following a hint in another post) I add the "-latomic" flag, I get the error "/bin/ld: cannot find /usr/lib64/libatomic.so.1.1.0". And indeed that file does not exist.
Any suggestions?
Gavin
Мобильная версия