libpthread.so.0: error adding symbols: DSO missing from command line

编译错误:

host/opt/ext-toolchain/bin/…/lib/gcc/arm-linux-gnueabi/5.3.1/…/…/…/…/arm-linux-gnueabi/bin/ld: /tmp/ccE6aAfo.o: undefined reference to symbol ‘pthread_join@@GLIBC_2.4’
linux/common/buildroot/host/usr//arm-buildroot-linux-gnueabi/sysroot/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [test] 错误 1

原因:
没有添加libpthread库文件。

解决方案:
在makefile中添加 -lpthread :
test:__LIB
$(CPP) test.cpp -g -o encoder $(Target) $(LIBS) $(LDFLAGS) -lpthread
@echo “generate encoder success!!!”

你可能感兴趣的:(编译)