Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linking to a MSVC DLL -- Undefined references?

Linking to a MSVC DLL -- Undefined references?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 384 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.
  • RogerBretonR Offline
    RogerBretonR Offline
    RogerBreton
    wrote on last edited by
    #1

    Open-Source MinGW 5.12
    Console application
    Need to link to existing MSVC DLL
    Have corresponding .h and .lib -- nothing else, in both 32 and 64 bit

    In main.cpp, I have call to a FDX_GetDevicePortList () function, which I know resides in FDX.DLL.

    Here is compiler output :

    cmd.exe /C "cd . && F:\Qt\Tools\mingw810_64\bin\g++.exe -g CMakeFiles/Console2.dir/Console2_autogen/mocs_compilation.cpp.obj CMakeFiles/Console2.dir/main.cpp.obj -o Console2.exe -Wl,--out-implib,libConsole2.dll.a -Wl,--major-image-version,0,--minor-image-version,0 F:/Qt/5.15.2/mingw81_64/lib/libQt5Core.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

    Roger Breton
    www.graxx.ca

    JKSHJ 1 Reply Last reply
    0
    • RogerBretonR RogerBreton

      Open-Source MinGW 5.12
      Console application
      Need to link to existing MSVC DLL
      Have corresponding .h and .lib -- nothing else, in both 32 and 64 bit

      In main.cpp, I have call to a FDX_GetDevicePortList () function, which I know resides in FDX.DLL.

      Here is compiler output :

      cmd.exe /C "cd . && F:\Qt\Tools\mingw810_64\bin\g++.exe -g CMakeFiles/Console2.dir/Console2_autogen/mocs_compilation.cpp.obj CMakeFiles/Console2.dir/main.cpp.obj -o Console2.exe -Wl,--out-implib,libConsole2.dll.a -Wl,--major-image-version,0,--minor-image-version,0 F:/Qt/5.15.2/mingw81_64/lib/libQt5Core.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      @RogerBreton said in Linking to a MSVC DLL -- Undefined references?:

      Open-Source MinGW
      ...
      MSVC DLL

      Unless the FDX.dll was written in C (or unless it has extern "C" in the headers), it is incompatible with MinGW. You must build your app with the same version of MSVC instead.

      EDIT: In addition, you must use Qt DLLs that were built with the same version of MSVC, as explained at https://forum.qt.io/topic/125649/change-compiler-from-mingw-to-msvc-not-possible

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      5
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        @JKSH said in Linking to a MSVC DLL -- Undefined references?:

        You must build your app with the same version of MSVC instead.

        Just to add to that, MSVC versions used to be incompatible with each other until VS2017 which was backward compatible with 2015.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

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