Closed telkamp closed 6 years ago
I needed to add "-pthread" to CMAKE_CXX_FLAGS in CMakeLists.txt to get the tests linking (tests/check): 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")' Without -pthread, I got the following error from the linker: libwdc.a(client.cpp.o): In functionstd::thread::thread<WebDAV::Client::async_download(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (bool)>, std::function<int (void*, unsigned long, unsigned long, unsigned long, unsigned long)>) const::{lambda()#1}>(WebDAV::Client::async_download(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (bool)>, std::function<int (void*, unsigned long, unsigned long, unsigned long, unsigned long)>) const::{lambda()#1}&&)': client.cpp:(.text+0x51a5): undefined reference topthread_create'
std::thread::thread<WebDAV::Client::async_download(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (bool)>, std::function<int (void*, unsigned long, unsigned long, unsigned long, unsigned long)>) const::{lambda()#1}>(WebDAV::Client::async_download(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (bool)>, std::function<int (void*, unsigned long, unsigned long, unsigned long, unsigned long)>) const::{lambda()#1}&&)': client.cpp:(.text+0x51a5): undefined reference to
-> I'm using Ubuntu 17.04 with gcc 6.3.0 See also https://stackoverflow.com/questions/34933042/undefined-reference-to-pthread-create-error-when-making-c11-application-with
Please, tell what version of WDC you use ? Try use last version - 1.0.9.
WDC
1.0.9
Sent from my Meizu M3s using FastHub
I've tested it with the current version 1.0.9 - now it works! Thank you for your support.
I needed to add "-pthread" to CMAKE_CXX_FLAGS in CMakeLists.txt to get the tests linking (tests/check): 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")' Without -pthread, I got the following error from the linker: libwdc.a(client.cpp.o): In function
std::thread::thread<WebDAV::Client::async_download(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (bool)>, std::function<int (void*, unsigned long, unsigned long, unsigned long, unsigned long)>) const::{lambda()#1}>(WebDAV::Client::async_download(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (bool)>, std::function<int (void*, unsigned long, unsigned long, unsigned long, unsigned long)>) const::{lambda()#1}&&)': client.cpp:(.text+0x51a5): undefined reference to
pthread_create'-> I'm using Ubuntu 17.04 with gcc 6.3.0 See also https://stackoverflow.com/questions/34933042/undefined-reference-to-pthread-create-error-when-making-c11-application-with