Linking to a MSVC DLL -- Undefined references?
RogerBreton last edited by
Open-Source MinGW 5.12
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 ."
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
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.