Shared Library
-
Hi ..
I want to create a dll file and use the same dll in another Qt project ..
Using Shared Library I have created dll .In another Qt Project I have included the Dll file . Dll path is specified in pro file ... I have included Dll file Debug folder ..When i debug the project I received warnings- redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]****
kindly explain me reason for the issues ...
Thanks In Advance .... -
Did You add library import/export macros?
Create a file, i.e.
mylibimport.h#include <QtCore/QtGlobal> #if defined(MY_LIBRARY) # define MYLIBRARY_EXPORT Q_DECL_EXPORT #else # define MYLIBRARY_EXPORT Q_DECL_IMPORT #endif
add definition to pro
DEFINES += MY_LIBRARY
Then add
MYLIBRARY_EXPORT
before every class or function visible outside:
i.e:#include <mylibimport.h> class MYLIBRARY_EXPORT someClass { //.... }; MYLIBRARY_EXPORT int someFunction() { }