Undefined reference to symbol 'pthread_create@

2019-06-23 22:55发布

问题:

I just pulled a git repository in which me and my friends are developing an application. When I am running make I am facing this error:

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 Makefile:182: recipe for target 'bin/release/ns' failed make[1]: * [bin/release/ns] Error 1 Makefile:133: recipe for target 'release' failed make: * [release] Error 2

my friend pulled the same branch and he runs it without any problem.

Could you please give me some hints about the fix? Detailed answer would be highly appreciated.

回答1:

You should add "-lpthread" to your library. Of cause, you should also add the directory of libpthread to your library directories.