Using Npcap with Qt Creator 6.4.3
-
Hi all,
I try to use npcap functions in Qt Creator
Version : Qt Creator 10.0.1
Based on Qt 6.4.3 (MSVC 2019, x86_64)Npcap 1.75
same function works on visual studio 2022
that's how i included npcap libraries :
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/'../../../../../../../Program Files/Npcap/Lib/' -lwpcap else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/'../../../../../../../Program Files/Npcap/Lib/' -lwpcap INCLUDEPATH += $$PWD/'../../../../../../../Program Files/Npcap/Include' DEPENDPATH += $$PWD/'../../../../../../../Program Files/Npcap/Include'
the error i receive on compilation:
mainwindow.obj:-1: error: LNK2019: unresolved external symbol pcap_findalldevs referenced in function "struct pcap_if * __cdecl find_devices(void)" (?find_devices@@YAPEAUpcap_if@@XZ)
Here is the the piece of code that makes the error :
pcap_if_t* find_devices() { pcap_if_t* alldevs = nullptr; // Initialize the pointer to nullptr char errbuf[PCAP_ERRBUF_SIZE]; if (pcap_findalldevs(&alldevs, errbuf) == -1) { std::cerr << "Error finding network interfaces: " << errbuf << std::endl; return nullptr; // Return nullptr on error } return alldevs; // Return the pointer to pcap_if_t }
-
17:33:19: Running steps for project Packet_Capture_GUI... 17:33:19: Configuration unchanged, skipping qmake step. 17:33:19: Starting: "C:\QT\Tools\QtCreator\bin\jom\jom.exe" C:\QT\Tools\QtCreator\bin\jom\jom.exe -f Makefile.Debug link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\Packet_Capture_GUI.exe @C:\Users\Dave\AppData\Local\Temp\Packet_Capture_GUI.exe.23536.31.jom mainwindow.obj : error LNK2019: unresolved external symbol pcap_findalldevs referenced in function "struct pcap_if * __cdecl find_devices(void)" (?find_devices@@YAPEAUpcap_if@@XZ) C:\Program Files\Npcap\Lib\wpcap.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64' debug\Packet_Capture_GUI.exe : fatal error LNK1120: 1 unresolved externals jom: C:\Users\Dave\Desktop\C++ Exercises\Qt Creator Projects\Project 1 - Network Packet GUI\build-Packet_Capture_GUI-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Makefile.Debug [debug\Packet_Capture_GUI.exe] Error 1120 jom: C:\Users\Dave\Desktop\C++ Exercises\Qt Creator Projects\Project 1 - Network Packet GUI\build-Packet_Capture_GUI-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Makefile [debug] Error 2 17:33:20: The process "C:\QT\Tools\QtCreator\bin\jom\jom.exe" exited with code 2. Error while building/deploying project Packet_Capture_GUI (kit: Desktop Qt 6.5.1 MSVC2019 64bit) When executing step "Make" 17:33:20: Elapsed time: 00:00.
I have tried linking against 32bit and against 64bit and both as well
-
Hi all,
I try to use npcap functions in Qt Creator
Version : Qt Creator 10.0.1
Based on Qt 6.4.3 (MSVC 2019, x86_64)Npcap 1.75
same function works on visual studio 2022
that's how i included npcap libraries :
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/'../../../../../../../Program Files/Npcap/Lib/' -lwpcap else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/'../../../../../../../Program Files/Npcap/Lib/' -lwpcap INCLUDEPATH += $$PWD/'../../../../../../../Program Files/Npcap/Include' DEPENDPATH += $$PWD/'../../../../../../../Program Files/Npcap/Include'
the error i receive on compilation:
mainwindow.obj:-1: error: LNK2019: unresolved external symbol pcap_findalldevs referenced in function "struct pcap_if * __cdecl find_devices(void)" (?find_devices@@YAPEAUpcap_if@@XZ)
Here is the the piece of code that makes the error :
pcap_if_t* find_devices() { pcap_if_t* alldevs = nullptr; // Initialize the pointer to nullptr char errbuf[PCAP_ERRBUF_SIZE]; if (pcap_findalldevs(&alldevs, errbuf) == -1) { std::cerr << "Error finding network interfaces: " << errbuf << std::endl; return nullptr; // Return nullptr on error } return alldevs; // Return the pointer to pcap_if_t }
-
@__d4ve__
I would start by copying and pasting the exact full linker command being executed from Creator. And make sure your (embedded)'
(single-quote) quoting is good for Windows. -
@JonB If i understand you right that , you advise me changing the linked libraries to be with
"
I used 'Add Library' Functionality of Qt Creator to attach NPCAP
anyway I tried that , same issue occurs
-
@JonB said in Using Npcap with Qt Creator 6.4.3:
I would start by copying and pasting the exact full linker command being executed from Creator.
17:33:19: Running steps for project Packet_Capture_GUI... 17:33:19: Configuration unchanged, skipping qmake step. 17:33:19: Starting: "C:\QT\Tools\QtCreator\bin\jom\jom.exe" C:\QT\Tools\QtCreator\bin\jom\jom.exe -f Makefile.Debug link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\Packet_Capture_GUI.exe @C:\Users\Dave\AppData\Local\Temp\Packet_Capture_GUI.exe.23536.31.jom mainwindow.obj : error LNK2019: unresolved external symbol pcap_findalldevs referenced in function "struct pcap_if * __cdecl find_devices(void)" (?find_devices@@YAPEAUpcap_if@@XZ) C:\Program Files\Npcap\Lib\wpcap.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64' debug\Packet_Capture_GUI.exe : fatal error LNK1120: 1 unresolved externals jom: C:\Users\Dave\Desktop\C++ Exercises\Qt Creator Projects\Project 1 - Network Packet GUI\build-Packet_Capture_GUI-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Makefile.Debug [debug\Packet_Capture_GUI.exe] Error 1120 jom: C:\Users\Dave\Desktop\C++ Exercises\Qt Creator Projects\Project 1 - Network Packet GUI\build-Packet_Capture_GUI-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Makefile [debug] Error 2 17:33:20: The process "C:\QT\Tools\QtCreator\bin\jom\jom.exe" exited with code 2. Error while building/deploying project Packet_Capture_GUI (kit: Desktop Qt 6.5.1 MSVC2019 64bit) When executing step "Make" 17:33:20: Elapsed time: 00:00.
I have tried linking against 32bit and against 64bit and both as well
-
17:33:19: Running steps for project Packet_Capture_GUI... 17:33:19: Configuration unchanged, skipping qmake step. 17:33:19: Starting: "C:\QT\Tools\QtCreator\bin\jom\jom.exe" C:\QT\Tools\QtCreator\bin\jom\jom.exe -f Makefile.Debug link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\Packet_Capture_GUI.exe @C:\Users\Dave\AppData\Local\Temp\Packet_Capture_GUI.exe.23536.31.jom mainwindow.obj : error LNK2019: unresolved external symbol pcap_findalldevs referenced in function "struct pcap_if * __cdecl find_devices(void)" (?find_devices@@YAPEAUpcap_if@@XZ) C:\Program Files\Npcap\Lib\wpcap.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64' debug\Packet_Capture_GUI.exe : fatal error LNK1120: 1 unresolved externals jom: C:\Users\Dave\Desktop\C++ Exercises\Qt Creator Projects\Project 1 - Network Packet GUI\build-Packet_Capture_GUI-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Makefile.Debug [debug\Packet_Capture_GUI.exe] Error 1120 jom: C:\Users\Dave\Desktop\C++ Exercises\Qt Creator Projects\Project 1 - Network Packet GUI\build-Packet_Capture_GUI-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Makefile [debug] Error 2 17:33:20: The process "C:\QT\Tools\QtCreator\bin\jom\jom.exe" exited with code 2. Error while building/deploying project Packet_Capture_GUI (kit: Desktop Qt 6.5.1 MSVC2019 64bit) When executing step "Make" 17:33:20: Elapsed time: 00:00.
I have tried linking against 32bit and against 64bit and both as well
-
@__d4ve__ said in Using Npcap with Qt Creator 6.4.3:
C:\Program Files\Npcap\Lib\wpcap.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
Until you resolve this nothing will link.
-