<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to properly use exterenal lib pcap++]]></title><description><![CDATA[<p dir="auto">How to properly use exterenal lib pcap++?</p>
<p dir="auto">Using msvc2015 sp3 as compiler and libs for same compiler.<br />
pcapplusplus-22.05-windows-vs2015 and npcap-sdk-0.1</p>
<p dir="auto">The example below crashes without error msg.</p>
<p dir="auto"><em><strong>.pro</strong></em></p>
<pre><code>QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h

FORMS += \
    mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target




INCLUDEPATH += $$PWD/npcap-sdk-0.1/Include
LIBS += -L$$PWD/npcap-sdk-0.1/Lib/x64 -lwpcap -lpacket -lws2_32
LIBS += -L$$PWD/npcap-sdk-0.1/Lib/x64 -lwpcap -lws2_32

INCLUDEPATH += $$PWD/pcapplusplus-22.05-windows-vs2015/header
LIBS +=      -L$$PWD/pcapplusplus-22.05-windows-vs2015/x64/Release -lCommon++ -lPacket++ -lPcap++        

</code></pre>
<p dir="auto"><em><strong>Minimal usage of lib:</strong></em></p>
<pre><code>//ext lib includes
#include "Packet.h"
#include "PayloadLayer.h"
#include "PcapFileDevice.h"&lt;-- related include

...

void MainWindow::on_problem_clicked()
{

    pcpp:: IFileReaderDevice* r;

    r=pcpp::IFileReaderDevice::getReader("");//&lt;----- crashes here, on program start, before accessing function ...


}


</code></pre>
<p dir="auto"><a href="https://files.fm/u/hybbthrht" target="_blank" rel="noopener noreferrer nofollow ugc">libs + project minimal download link</a></p>
<p dir="auto"><a href="https://github.com/seladb/PcapPlusPlus/releases/tag/v22.05" target="_blank" rel="noopener noreferrer nofollow ugc">pcap++ lib dl link</a></p>
]]></description><link>https://forum.qt.io/topic/136906/how-to-properly-use-exterenal-lib-pcap</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 10:16:17 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/136906.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 31 May 2022 20:45:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Thu, 02 Jun 2022 11:55:39 GMT]]></title><description><![CDATA[<p dir="auto">Built the pcap++ lib using msvc2015 , on same PC as msvc2015 compililer used in Qt.<br />
To build pcap++ it required pthreads32 and npcap-sdk or winCap sdk.<br />
Tryed building the lib with both. Unfortunately both created same crash if using the lib in Qt, same as using pcap++ prebuilt version msvc2015 .<br />
Also building and running debug version crashed and no error codes visible.<br />
The pcap lib probably is fine, but linking it or the additional lib depencencies to qt appear to crash the app instantly.</p>
<p dir="auto">In addition i had to include to qt PRO file the npcap sdk to get rid of missing dependencies:</p>
<p dir="auto">INCLUDEPATH += $$PWD/npcap-sdk-0.1/Include<br />
LIBS += -L$$PWD/npcap-sdk-0.1/Lib/x64 -lwpcap -lPacket<br />
LIBS += -lws2_32</p>
<p dir="auto">Could be something simple but i have little experiecne with libs.</p>
<p dir="auto"><img src="https://i.ibb.co/chfNNPj/prob.jpg" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/716253</link><guid isPermaLink="true">https://forum.qt.io/post/716253</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 02 Jun 2022 11:55:39 GMT</pubDate></item><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Wed, 01 Jun 2022 16:01:26 GMT]]></title><description><![CDATA[<p dir="auto">A debug version normally ends with a 'd' in the library name but it might be different here - don't know.<br />
If you build in debug mode try it with release and see  if it still crashes.<br />
Also you can use Dependency Walker to see if the msvcrtxxx.dll or msvcrtxxx<strong>D</strong>.dll is used - when both are used something is wrong and your app will most likely crash.</p>
]]></description><link>https://forum.qt.io/post/716158</link><guid isPermaLink="true">https://forum.qt.io/post/716158</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 01 Jun 2022 16:01:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Wed, 01 Jun 2022 15:58:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> said in <a href="/post/716156">How to properly use exterenal lib pcap++</a>:</p>
<blockquote>
<p dir="auto">@Q139 said in <a href="/post/716155">How to properly use exterenal lib pcap++</a>:</p>
<blockquote>
<p dir="auto">How to check the .lib file version and how to set compiler up for same version?</p>
</blockquote>
<p dir="auto">Ask the creator of the lib.</p>
</blockquote>
<p dir="auto">I see. Thanks for previous post , probably directed right way.</p>
]]></description><link>https://forum.qt.io/post/716157</link><guid isPermaLink="true">https://forum.qt.io/post/716157</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 01 Jun 2022 15:58:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Wed, 01 Jun 2022 15:56:07 GMT]]></title><description><![CDATA[<p dir="auto">@Q139 said in <a href="/post/716155">How to properly use exterenal lib pcap++</a>:</p>
<blockquote>
<p dir="auto">How to check the .lib file version and how to set compiler up for same version?</p>
</blockquote>
<p dir="auto">Ask the creator of the lib.</p>
]]></description><link>https://forum.qt.io/post/716156</link><guid isPermaLink="true">https://forum.qt.io/post/716156</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 01 Jun 2022 15:56:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Wed, 01 Jun 2022 15:54:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> said in <a href="/post/716144">How to properly use exterenal lib pcap++</a>:</p>
<blockquote>
<p dir="auto">make sure the pcap library is linked against the same MSVC runtime as your app</p>
</blockquote>
<p dir="auto">How to check the .lib file version and how to set compiler up for same version?</p>
]]></description><link>https://forum.qt.io/post/716155</link><guid isPermaLink="true">https://forum.qt.io/post/716155</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 01 Jun 2022 15:54:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Wed, 01 Jun 2022 14:37:14 GMT]]></title><description><![CDATA[<p dir="auto">Also you must not mix debug and release libraries - make sure the pcap library is linked against the same MSVC runtime as your app.</p>
]]></description><link>https://forum.qt.io/post/716144</link><guid isPermaLink="true">https://forum.qt.io/post/716144</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 01 Jun 2022 14:37:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to properly use exterenal lib pcap++ on Wed, 01 Jun 2022 14:12:18 GMT]]></title><description><![CDATA[<p dir="auto">@Q139 said in <a href="/post/716034">How to properly use exterenal lib pcap++</a>:</p>
<blockquote>
<p dir="auto">r=pcpp::IFileReaderDevice::getReader("")</p>
</blockquote>
<p dir="auto">This isn't a Qt question. Does the argument passed to this method need to be an existing file (or maybe at least a non-empty string)? You can validate what you pass to this method before you call it (is it an existing file, does it specify a writeable file location, etc.).</p>
]]></description><link>https://forum.qt.io/post/716138</link><guid isPermaLink="true">https://forum.qt.io/post/716138</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Wed, 01 Jun 2022 14:12:18 GMT</pubDate></item></channel></rss>