linux - 对符号 'pthread_key_delete@@GLIBC_2.2.5 的 undefined reference

标签 linux linker-errors undefined-reference

我正在尝试在 Ubuntu 中制作文件,当我制作文件时,我不断收到此错误:

/usr/bin/ld: ../../gtest-1.7.0/libgtest.a(gtest-all.cc.o): undefined reference to symbol     'pthread_key_delete@@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[2]: *** [src/tests/run_tests] Error 1
make[1]: *** [src/tests/CMakeFiles/run_tests.dir/all] Error 2
make: *** [all] Error 2

我看到有人提到要进入 Makefile 并将“-L/lib64 -l pthread”添加到变量 LDFLAGS 中,但您是怎么做到的?这里是 linux 的新手 =X

最佳答案

上面的链接问题通过添加

解决
-lpthread -lm to CMakeLists.txt (target link libraries for luxrender);
TARGET_LINK_LIBRARIES(... -lpthread -lm)

关于linux - 对符号 'pthread_key_delete@@GLIBC_2.2.5 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25617839/

相关文章:

c++ - 什么是 undefined reference /未解析的外部符号错误,我该如何解决?

c++ - 什么是 undefined reference /未解析的外部符号错误,我该如何解决?

java - Java中更改当前目录在linux中实现 "cd"命令

linux - 无法使用 scp 在 ubuntu 机器之间复制文件

c++ - #include <boost/chrono.hpp> 导致无法解析的外部符号,使用了 bcp

c++ - 使用模板的 undefined symbol

c++ - 什么是 undefined reference /未解析的外部符号错误以及如何修复它?

c - 如何在c中获取另一个进程的pid?

linux - 内核 Oops 从用户空间访问 BAR 寄存器

c++ - boost/archive/binary_woarchive.hpp 和/或 boost/archive/binary_wiarchive.hpp 的序列化示例?