且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

cmake:未定义对任何pcap函数的引用

更新时间:2023-11-10 18:54:10

您应将FindPCAP.cmake文件包括并使用到CMakeLists.txt中。这是一个: https://github.com/bro/cmake/blob/master /FindPCAP.cmake

You should include and use a FindPCAP.cmake file to your CMakeLists.txt. Here is one: https://github.com/bro/cmake/blob/master/FindPCAP.cmake

将FindPCAP.cmake放在项目的源目录中,然后尝试将CMakeLists.txt更改为:

Put FindPCAP.cmake in your project's source directory and try changing your CMakeLists.txt to:

cmake_minimum_required(VERSION 3.7)
project(mypr)

set(CMAKE_CXX_STANDARD 11)

include(FindPCAP.cmake)

set(SOURCE_FILES main.cpp)
add_executable(mypr ${SOURCE_FILES})
target_link_libraries(mypr ${PCAP_LIBRARY})