Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Soda9521 opened this issue Jun 24, 2023 · 2 comments
Open

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

Soda9521 opened this issue Jun 24, 2023 · 2 comments

Comments

@Soda9521
Copy link

[ 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
Copy link

thsheep commented Aug 16, 2023

把这一行添加到CmakeLists.txt

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

@JingchengLi
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants