PCAP in CLion

Answered

Hi, i really need to use PCAP library in CLion. How can I import this library?

1
2 comments
Avatar
Permanently deleted user

Hi, I had same problem. Follow these steps:

  1. In terminal use command "sudo apt-get install libpcap-dev" (that's for ubuntu, don't know about others)
  2. In your code use "include <pcap/pcap.h>"(depends on C or C++)
  3. Download and store to your project root file FindPCAP.cmake from https://github.com/bro/cmake/blob/master/FindPCAP.cmake
  4. in your CMakeList.txt (CMake file) add these lines:

#after your flags

SET(CMAKE_MODULE_PATH "/your_project_directory")

find_package(PCAP REQUIRED)

#in the end

target_link_libraries(YOUR_PROJECT ${PCAP_LIBRARY})

 

Helped me, good luck!

0

Please sign in to leave a comment.