DevDungeon
- Labs
Knowledge
Social
DevDungeon
Knowledge
Social
This is an old revision of the document!
Get Qt from https://www.qt.io/download.
For Qt in Python, see PyQt5 Tutorial
Qt has multiple levels of verbosity for logging. If you are able to print qInfo()
messages but qDebug()
is not outputting anything, you need to turn on the debug messages.
#include <QDebug> // ... qInfo() << "Is this working?"; qDebug() << "but not this?";
You can set the Qt logging levels in ~/.config/QtProject/qtlogging.ini
like this:
# ~/.config/QtProject/qtlogging.ini [Rules] *.debug=true # Enable all debug messages qt.*.debug=false # Disable qt debug messages, leaving only ours
// If using qt creator, add these // to the project file in Windows // //# Pcap specific build stuff for Windows (in qmake) //INCLUDEPATH += C:/WpdPack/Include //LIBS += C:/WpdPack/Lib/wpcap.lib //LIBS += C:/WpdPack/Lib/Packet.lib //CONFIG += no_lflags_merge // //# Fixes the missing inet_to_ntoa //LIBS += -lws2_32 #define HAVE_REMOTE #include <winsock2.h> #include "pcap.h" /* prototype of the packet handler */ void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); int main() { pcap_if_t *alldevs; pcap_if_t *d; int inum; int i=0; pcap_t *adhandle; char errbuf[PCAP_ERRBUF_SIZE]; /* Retrieve the device list on the local machine */ if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) { fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); exit(1); } /* Print the list */ for(d=alldevs; d; d=d->next) { printf("%d. %s", ++i, d->name); if (d->description) printf(" (%s)\n", d->description); else printf(" (No description available)\n"); } if(i==0) { printf("\nNo interfaces found! Make sure WinPcap is installed.\n"); return -1; } }