Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What's the current way to handle linking Qt as a dll to my native C++ app?
Qt 6.12 LTS is out! See what's new in the release blog

What's the current way to handle linking Qt as a dll to my native C++ app?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dogoooooo
    wrote on last edited by
    #1

    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:

    #include <QtCore\QLibrary>
    // #include <QtWidgets\QWidget>
    int main()
    {
        QLibrary myLibrary("./lib/mylib-frontend.dll");
    

    properties.json

    {
        "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
    }
    

    tasks.json:

    {
        "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"
    }
    
    

    Error:

     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<char, true>(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<char16_t>::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<char16_t>::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).
    
    jeremy_kJ 1 Reply Last reply
    0
    • D dogoooooo

      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:

      #include <QtCore\QLibrary>
      // #include <QtWidgets\QWidget>
      int main()
      {
          QLibrary myLibrary("./lib/mylib-frontend.dll");
      

      properties.json

      {
          "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
      }
      

      tasks.json:

      {
          "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"
      }
      
      

      Error:

       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<char, true>(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<char16_t>::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<char16_t>::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).
      
      jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by
      #2

      @dogoooooo said in What's the current way to handle linking Qt as a dll to my native C++ app?:

      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:

      tasks.json:

      {
          "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",
      

      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.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      D 1 Reply Last reply
      1
      • jeremy_kJ jeremy_k

        @dogoooooo said in What's the current way to handle linking Qt as a dll to my native C++ app?:

        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:

        tasks.json:

        {
            "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",
        

        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.

        D Offline
        D Offline
        dogoooooo
        wrote on last edited by dogoooooo
        #3

        @jeremy_k

        Thanks so much, I swaped over to the wingw64, but getting issues still:

        {
            "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"
        }
        
        
        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<char, true>(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<char16_t>::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<char16_t>::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).
        
        jeremy_kJ 1 Reply Last reply
        0
        • D dogoooooo

          @jeremy_k

          Thanks so much, I swaped over to the wingw64, but getting issues still:

          {
              "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"
          }
          
          
          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<char, true>(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<char16_t>::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<char16_t>::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).
          
          jeremy_kJ Offline
          jeremy_kJ Offline
          jeremy_k
          wrote on last edited by
          #4

          @dogoooooo said in What's the current way to handle linking Qt as a dll to my native C++ app?:

          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.

          [...]
                          "-lstdc++",
                          "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
          
          Starting build...
          C:/msys64/mingw64/bin/gcc.exe [...] -lstdc++ "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
          

          Asking a question about code? http://eel.is/iso-c++/testcase/

          S 1 Reply Last reply
          1
          • jeremy_kJ jeremy_k

            @dogoooooo said in What's the current way to handle linking Qt as a dll to my native C++ app?:

            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.

            [...]
                            "-lstdc++",
                            "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
            
            Starting build...
            C:/msys64/mingw64/bin/gcc.exe [...] -lstdc++ "-L C:/Qt/6.5.1/mingw_64/lib/ -lQt6Core"
            
            S Offline
            S Offline
            SimonSchroeder
            wrote on last edited by
            #5

            @jeremy_k said in What's the current way to handle linking Qt as a dll to my native C++ app?:

            They probably need to be separated into individual quoted values separated by a comma.

            Good catch. Furthermore, there should be no space after -L.

            jeremy_kJ 1 Reply Last reply
            0
            • S SimonSchroeder

              @jeremy_k said in What's the current way to handle linking Qt as a dll to my native C++ app?:

              They probably need to be separated into individual quoted values separated by a comma.

              Good catch. Furthermore, there should be no space after -L.

              jeremy_kJ Offline
              jeremy_kJ Offline
              jeremy_k
              wrote on last edited by
              #6

              @SimonSchroeder said in What's the current way to handle linking Qt as a dll to my native C++ app?:

              Good catch. Furthermore, there should be no space after -L.

              Separating -L and the link path seems to be fine. I don't see it mentioned explicitly in the documentation like the two variations of -l, but it has worked for a significant length of time. That may be a general allowance for -<option><value> arguments. It can even be necessary if relying on a shell to convert ~ to $HOME. ie:
              g++ -L ~/Qt/5.15.2/gcc_64/lib -l Qt5Core a.cpp works.
              g++ -L~/Qt/5.15.2/gcc_64/lib -l Qt5Core a.cpp does not.

              Asking a question about code? http://eel.is/iso-c++/testcase/

              1 Reply Last reply
              2

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt
              • Unsolved