Windows add pcap to project
Solved
General and Desktop
-
I am having some troubles with adding the pcap lib to my Qt project on windows
I have tried multiple examples I've found here and on other websites but in the end I always have the same message "pcap.h No such file or directory" after trying to include it in my main.cpp file
#include "mainwindow.h" #include <QApplication> #include <winsock2.h> #include <pcap.h> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
This is what I have so far in my main.cpp
#------------------------------------------------- # # Project created by QtCreator 2018-05-28T03:27:57 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = hello TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h\ FORMS += mainwindow.ui INCLUDEPATH += C:/WpdPack/Include LIBS += "-LC:/WpdPack/Lib" -lwpcap -lws2_32 DEFINES += HAVE_REMOTE DEFINES += WPCAP
And this is my .pro file
I installed WpdPack at the root of C:/
Any idea why it autocompletes pcap.h when I'm including it but still displays an error when I compile/run it?
Also I think it comes from the pcap.h file that has this line (and only this line)
#include <pcap/pcap.h>
Thanks
-
Hi and welcome to devnet,
What exact error do you have ?
-
Where is that file located on your system ?
-
Then your
include
statement is wrong, it should just be#include <pcap.h>