aliyun / aliyun-oss-cpp-sdk

Aliyun OSS SDK for C++
Other
184 stars 88 forks source link

undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' #149

Open Soda9521 opened 1 year ago

Soda9521 commented 1 year ago

[ 96%] Built target cpp-sdk [ 96%] Linking CXX executable cpp-sdk-sample /usr/bin/ld: ../lib/libalibabacloud-oss-cpp-sdk.a(ResumableCopier.cc.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status sample/CMakeFiles/cpp-sdk-sample.dir/build.make:212: recipe for target 'sample/cpp-sdk-sample' failed make[2]: [sample/cpp-sdk-sample] Error 1 CMakeFiles/Makefile2:141: recipe for target 'sample/CMakeFiles/cpp-sdk-sample.dir/all' failed make[1]: [sample/CMakeFiles/cpp-sdk-sample.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2 为什么会导致 pthread_create?

thsheep commented 1 year ago

把这一行添加到CmakeLists.txt

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

JingchengLi commented 2 months ago

遇到同样的问题。 奇怪怎么还不修复这个问题?难道让每个用户都手动改?