<?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[What&#x27;s the current way to handle linking Qt as a dll to my native C++ app?]]></title><description><![CDATA[<p dir="auto">I'm trying just to load in the  libs into my C++ project but can't seem to do it, please help me out, it's been a few days of banging my head on the wall:</p>
<pre><code>#include &lt;QtCore\QLibrary&gt;
// #include &lt;QtWidgets\QWidget&gt;
int main()
{
    QLibrary myLibrary("./lib/mylib-frontend.dll");
</code></pre>
<p dir="auto">properties.json</p>
<pre><code>{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${default}",
                "C:/Qt/6.5.1/msvc2019_64/include",
                "${workspaceFolder}/lib"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22000.0",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}
</code></pre>
<p dir="auto">tasks.json:</p>
<pre><code>{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\gcc.exe",
            "args": [
                "-I",
                "C:/Qt/6.5.1/msvc2019_64/include",
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${workspaceFolder}\\build\\${fileBasenameNoExtension}.exe",
                "-lstdc++",
                "-L C:/Qt/6.5.1/msvc2019_64/lib/ -lQt6Core"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

</code></pre>
<p dir="auto">Error:</p>
<pre><code> Executing task: C/C++: gcc.exe build active file 

Starting build...
C:\msys64\mingw64\bin\gcc.exe -I C:/Qt/6.5.1/msvc2019_64/include -fdiagnostics-color=always -g C:\Users\xxxxx\Documents\Development\Cpp\cpp-xxxxxa-frontend\src\main.cpp -o C:\Users\xxxxx\Documents\Development\Cpp\cpp-xxxxxa-frontend\build\main.exe -lstdc++ "-L C:/Qt/6.5.1/msvc2019_64/lib/ -lQt6Core"
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xxxxx\AppData\Local\Temp\ccDqkaZL.o: in function `main':
C:/Users/xxxxx/Documents/Development/Cpp/cpp-xxxxxa-frontend/src/main.cpp:5: undefined reference to `__imp__ZN8QLibraryC1ERK7QStringP7QObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/xxxxx/Documents/Development/Cpp/cpp-xxxxxa-frontend/src/main.cpp:52: undefined reference to `__imp__ZN8QLibraryD1Ev'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xxxxx\AppData\Local\Temp\ccDqkaZL.o:C:/Qt/6.5.1/msvc2019_64/include/QtCore/qversiontagging.h:125: undefined reference to `__imp_qt_version_tag_6_5'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xxxxx\AppData\Local\Temp\ccDqkaZL.o: in function `QString::QString(char const*)':
C:/Qt/6.5.1/msvc2019_64/include/QtCore/qstring.h:1029: undefined reference to `__imp__ZN7QString8fromUtf8E14QByteArrayView'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xxxxx\AppData\Local\Temp\ccDqkaZL.o: in function `QByteArrayView::QByteArrayView&lt;char, true&gt;(char const*, long long)':
C:/Qt/6.5.1/msvc2019_64/include/QtCore/qbytearrayview.h:137: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Qt/6.5.1/msvc2019_64/include/QtCore/qbytearrayview.h:137: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xxxxx\AppData\Local\Temp\ccDqkaZL.o: in function `QtPrivate::QPodArrayOps&lt;char16_t&gt;::destroyAll()':
C:/Qt/6.5.1/msvc2019_64/include/QtCore/qarraydataops.h:95: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Qt/6.5.1/msvc2019_64/include/QtCore/qarraydataops.h:96: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xxxxx\AppData\Local\Temp\ccDqkaZL.o: in function `QTypedArrayData&lt;char16_t&gt;::deallocate(QArrayData*)':
C:/Qt/6.5.1/msvc2019_64/include/QtCore/qarraydata.h:124: undefined reference to `__imp__ZN10QArrayData10deallocateEPS_xx'
collect2.exe: error: ld returned 1 exit status

Build finished with error(s).
</code></pre>
]]></description><link>https://forum.qt.io/topic/145859/what-s-the-current-way-to-handle-linking-qt-as-a-dll-to-my-native-c-app</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Nov 2026 20:52:21 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/145859.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 18 Jun 2023 23:45:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to What&#x27;s the current way to handle linking Qt as a dll to my native C++ app? on Thu, 22 Jun 2023 07:48:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/simonschroeder">@<bdi>SimonSchroeder</bdi></a> said in <a href="/post/762298">What's the current way to handle linking Qt as a dll to my native C++ app?</a>:</p>
<blockquote>
<p dir="auto">Good catch. Furthermore, there should be no space after <code>-L</code>.</p>
</blockquote>
<p dir="auto">Separating -L and the link path seems to be fine. I don't see it mentioned explicitly in the <a href="https://gcc.gnu.org/onlinedocs/gcc-11.4.0/gcc/Directory-Options.html#index-L" target="_blank" rel="noopener noreferrer nofollow ugc">documentation</a> like the <a href="https://gcc.gnu.org/onlinedocs/gcc-11.4.0/gcc/Link-Options.html#index-l" target="_blank" rel="noopener noreferrer nofollow ugc">two variations of -l,</a> but it has worked for a significant length of time. That may be a general allowance for -&lt;option&gt;&lt;value&gt; arguments. It can even be necessary if relying on a shell to convert ~ to $HOME. ie:<br />
<code>g++ -L ~/Qt/5.15.2/gcc_64/lib -l Qt5Core a.cpp</code> works.<br />
<code>g++ -L~/Qt/5.15.2/gcc_64/lib -l Qt5Core a.cpp</code> does not.</p>
]]></description><link>https://forum.qt.io/post/762304</link><guid isPermaLink="true">https://forum.qt.io/post/762304</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Thu, 22 Jun 2023 07:48:28 GMT</pubDate></item><item><title><![CDATA[Reply to What&#x27;s the current way to handle linking Qt as a dll to my native C++ app? on Thu, 22 Jun 2023 06:40:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeremy_k">@<bdi>jeremy_k</bdi></a> said in <a href="/post/762229">What's the current way to handle linking Qt as a dll to my native C++ app?</a>:</p>
<blockquote>
<p dir="auto">They probably need to be separated into individual quoted values separated by a comma.</p>
</blockquote>
<p dir="auto">Good catch. Furthermore, there should be no space after <code>-L</code>.</p>
]]></description><link>https://forum.qt.io/post/762298</link><guid isPermaLink="true">https://forum.qt.io/post/762298</guid><dc:creator><![CDATA[SimonSchroeder]]></dc:creator><pubDate>Thu, 22 Jun 2023 06:40:46 GMT</pubDate></item><item><title><![CDATA[Reply to What&#x27;s the current way to handle linking Qt as a dll to my native C++ app? on Wed, 21 Jun 2023 16:43:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dogoooooo">@<bdi>dogoooooo</bdi></a> said in <a href="/post/761867">What's the current way to handle linking Qt as a dll to my native C++ app?</a>:</p>
<p dir="auto">I'm not sure what build tool is in use here, so maybe this is ok, but it looks like the library path (-L) and library link (-l) flags are being combined into a single argument. They probably need to be separated into individual quoted values separated by a comma.</p>
<blockquote>
<pre><code>[...]
                "-lstdc++",
                "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
</code></pre>
</blockquote>
<blockquote>
<pre><code>Starting build...
C:/msys64/mingw64/bin/gcc.exe [...] -lstdc++ "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
</code></pre>
</blockquote>
]]></description><link>https://forum.qt.io/post/762229</link><guid isPermaLink="true">https://forum.qt.io/post/762229</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Wed, 21 Jun 2023 16:43:02 GMT</pubDate></item><item><title><![CDATA[Reply to What&#x27;s the current way to handle linking Qt as a dll to my native C++ app? on Mon, 19 Jun 2023 06:48:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeremy_k">@<bdi>jeremy_k</bdi></a></p>
<p dir="auto">Thanks so much, I swaped over to the wingw64, but getting issues still:</p>
<pre><code>{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:/msys64/mingw64/bin/gcc.exe",
            "args": [
                "-I",
                "C:/Qt/6.5.1/mingw_64/include",
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${workspaceFolder}\\build\\${fileBasenameNoExtension}.exe",
                "-lstdc++",
                "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

</code></pre>
<pre><code>Starting build...
C:/msys64/mingw64/bin/gcc.exe -I C:/Qt/6.5.1/mingw_64/include -fdiagnostics-color=always -g C:\Users\user\Documents\Development\Cpp\cpp-project-frontend\src\main.cpp -o C:\Users\user\Documents\Development\Cpp\cpp-project-frontend\build\main.exe -lstdc++ "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\ccv1QKZq.o: in function `main':
C:/Users/user/Documents/Development/Cpp/cpp-project-frontend/src/main.cpp:5: undefined reference to `__imp__ZN8QLibraryC1ERK7QStringP7QObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/user/Documents/Development/Cpp/cpp-project-frontend/src/main.cpp:52: undefined reference to `__imp__ZN8QLibraryD1Ev'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\ccv1QKZq.o:C:/Qt/6.5.1/mingw_64/include/QtCore/qversiontagging.h:125: undefined reference to `__imp_qt_version_tag_6_5'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\ccv1QKZq.o: in function `QString::QString(char const*)':
C:/Qt/6.5.1/mingw_64/include/QtCore/qstring.h:1029: undefined reference to `__imp__ZN7QString8fromUtf8E14QByteArrayView'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\ccv1QKZq.o: in function `QByteArrayView::QByteArrayView&lt;char, true&gt;(char const*, long long)':
C:/Qt/6.5.1/mingw_64/include/QtCore/qbytearrayview.h:137: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Qt/6.5.1/mingw_64/include/QtCore/qbytearrayview.h:137: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\ccv1QKZq.o: in function `QtPrivate::QPodArrayOps&lt;char16_t&gt;::destroyAll()':
C:/Qt/6.5.1/mingw_64/include/QtCore/qarraydataops.h:95: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Qt/6.5.1/mingw_64/include/QtCore/qarraydataops.h:96: undefined reference to `__imp__Z9qt_assertPKcS0_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\ccv1QKZq.o: in function `QTypedArrayData&lt;char16_t&gt;::deallocate(QArrayData*)':
C:/Qt/6.5.1/mingw_64/include/QtCore/qarraydata.h:124: undefined reference to `__imp__ZN10QArrayData10deallocateEPS_xx'
collect2.exe: error: ld returned 1 exit status

Build finished with error(s).
</code></pre>
]]></description><link>https://forum.qt.io/post/761867</link><guid isPermaLink="true">https://forum.qt.io/post/761867</guid><dc:creator><![CDATA[dogoooooo]]></dc:creator><pubDate>Mon, 19 Jun 2023 06:48:47 GMT</pubDate></item><item><title><![CDATA[Reply to What&#x27;s the current way to handle linking Qt as a dll to my native C++ app? on Mon, 19 Jun 2023 04:10:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dogoooooo">@<bdi>dogoooooo</bdi></a> said in <a href="/post/761837">What's the current way to handle linking Qt as a dll to my native C++ app?</a>:</p>
<blockquote>
<p dir="auto">I'm trying just to load in the  libs into my C++ project but can't seem to do it, please help me out, it's been a few days of banging my head on the wall:</p>
<p dir="auto">tasks.json:</p>
<pre><code>{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\gcc.exe",
            "args": [
                "-I",
                "C:/Qt/6.5.1/msvc2019_64/include",
</code></pre>
</blockquote>
<p dir="auto">It looks like this is attempting to use the MinGW compiler with libraries built for MSVC 2019. I believe that the two toolchains are incompatible.</p>
]]></description><link>https://forum.qt.io/post/761846</link><guid isPermaLink="true">https://forum.qt.io/post/761846</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Mon, 19 Jun 2023 04:10:17 GMT</pubDate></item></channel></rss>