c++ - make : error adding symbols: DSO missing from command line 时出错

标签 c++ linux makefile

我正在尝试编译从 git 存储库(OpenNI2,https://github.com/occipital/OpenNI2)下载的一些代码。运行 make 后出现以下错误:

make -C Source/Tools/NiViewer
make[1]: Entering directory `/home/karnivaurus/Data/Libraries/OpenNI2/Source/Tools/NiViewer'
g++ -o ../../../Bin/x64-Release/NiViewer ./../../../Bin/Intermediate/x64-Release/NiViewer/Device.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Draw.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Keyboard.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Menu.o ./../../../Bin/Intermediate/x64-Release/NiViewer/MouseInput.o ./../../../Bin/Intermediate/x64-Release/NiViewer/NiViewer.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Capture.o -L../../../ThirdParty/PSCommon/XnLib/Bin/x64-Release -L../../../Bin/x64-Release -lglut -lGL -lOpenNI2 -lXnLib -Wl,-rpath ./
/usr/bin/ld: ../../../ThirdParty/PSCommon/XnLib/Bin/x64-Release/libXnLib.a(XnLinuxMutex.o): undefined reference to symbol 'pthread_mutexattr_settype@@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
make[1]: *** [../../../Bin/x64-Release/NiViewer] Error 1
make[1]: Leaving directory `/home/karnivaurus/Data/Libraries/OpenNI2/Source/Tools/NiViewer'
make: *** [Source/Tools/NiViewer] Error 2

关于我应该如何解决这个问题有什么想法吗?

最佳答案

您必须将指令“-lpthread”添加到您的编译器,它已解决。

例如,如果您之前的代码是: g++ mycode.cpp -o myexecutable

现在你必须把 g++ mycode.cpp -lpthread -o myexecutable

关于c++ - make : error adding symbols: DSO missing from command line 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26526553/

相关文章:

linux - 如何比较Linux中特定格式的日期

build-process - 制作带有两个目标的源

linux - Debian/Ubuntu 软件包默认安装在 root 中

c++ - 如何在 C++ 中格式化标志?

c++ - Linux套接字文件描述符通常适合散列吗

linux - 如何仅在第一次打开 konsole 时运行特定的 .bashrc 代码

bash - Makefile 和 docker 附加。如何从其他Makefile的任务中执行?

c++ - C++ 中嵌套增强型 for 循环的范围

c++ - 应用程序部署——客户端无音频、无图像

c++ - 二进制搜索排序 vector 中的对象,其中包含一些无意义的条目作为干扰