I have built an app in Qt Creator on Windows, and it builds and runs correctly.
I have received header, .lib and .dll from a vendor built with Visual Studio on Windows. I would like to link to to their libraries. I do not have access to their source code.
I'm using the g++ toolset and fail at link time (exported symbols, I assume). The vendor's VendorClass.h, VendorClass.lib and VendorClass.dll are all in "C:/Program Files/VendorTools/lib"
My .pro file has
INCLUDEPATH += "C:/Program Files/VendorTools/lib"
LIBS += -L"C:/Program Files/VendorTools/lib" -lVendorClass
INCLUDEPATH += "C:/Program Files/VendorTools/lib"
LIBS += -L"C:/Program Files/VendorTools/lib" -lVendorClass
To copy to clipboard, switch view to plain text mode
I edit the vendor's header file so that it reads:
class Q_DECL_IMPORT VendorClass
{
public:
VendorClass();
}
class Q_DECL_IMPORT VendorClass
{
public:
VendorClass();
}
To copy to clipboard, switch view to plain text mode
(I've also tried declaring the class with __declspec(dllimport) ), same results.
Error is something like:
undefined reference to '__imp___ZN5VendorClassC1ERKSs'
dumpbin /linkermember VendorClass.lib shows a decorated class name that differs from the linker error I get from Qt.
How do I properly declare and compile a class so that it will link to a VC2008-compiled .lib for a .dll? Or is there a compiler flag that is required for properly using a Windows dll.
Bookmarks