【发布时间】:2021-04-29 00:33:57
【问题描述】:
我正在尝试将 pcap 函数添加到我在 Linux 上的 Clion 中的 C++ 项目中。
我的 h 文件包含:
#include <pcap/pcap.h>
CMAKE 文件也更新了。
而不是使用下一个命令:
if (NOT MSVC)
target_link_libraries(${TARGET} pthread)
endif()
现在是:
if (NOT MSVC)
target_link_libraries(${TARGET} pthread pcap)
endif()
仍然出现下一个错误:
undefined reference to "pcap_open_dead"
undefined reference to "pcap_dump_open"
undefined reference to "pcap_dump_close"
undefined reference to "pcap_close"
有人知道怎么解决吗?
谢谢
【问题讨论】:
-
你能在
VERBOSE模式下编译并显示你得到的输出吗? -
请告诉我们 pcap 库的实际位置...
标签: c++ cmake clion pcap undefined-reference