1. undefined reference to symbol ‘pthread_key_delete@@GLIBC_2.2.5

未定义对某符号的引用,该错误为链接时(linking)发生的错误。有如下方式的解决方案:

  • 修改 Makefile 文件,为变量 LDFLAGS加入,-L /lib64 -l pthread
    • 通过TARGET_LINK_LIBRARIES(... -lpthread -lm)-lpthread -lm添加进 CMakelists.txt文件;

2. 通过 cmake 的方式链接 google protobuf

How to link google protobuf libraries via cmake on linux?

include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
...
target_link_libraries(complex
    ${Boost_FILESYSTEM_LIBRARY}
    ${Boost_SYSTEM_LIBRARY}
    ${PROTOBUF_LIBRARY}
)

相关文章:

  • 2021-10-05
  • 2021-08-10
  • 2021-11-14
  • 2021-08-25
  • 2021-07-13
  • 2022-01-03
  • 2021-09-10
猜你喜欢
  • 2021-08-17
  • 2021-11-18
  • 2021-12-28
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
相关资源
相似解决方案