Skip to content
QtWS25 Last Chance
  • 0 Votes
    3 Posts
    3k Views
    I figured out my problem... I forgot to include the widget in the .lib.pro file...
  • 0 Votes
    2 Posts
    2k Views
    Hi @Michael-R-LegakoL-3com-com, I think a better approach, is to use a macro to apply the dllimport/export, and then enable that macro in the library only. For example, if you look at qmake's simple_dll test example, the simple.h header contains: #ifdef SIMPLEDLL_MAKEDLL # define SIMPLEDLL_EXPORT Q_DECL_EXPORT #else # define SIMPLEDLL_EXPORT Q_DECL_IMPORT #endif class SIMPLEDLL_EXPORT Simple { ... } Then the simple_dll.pro file contains: DEFINES += SIMPLEDLL_MAKEDLL So, this way, when the library is being built (via simple_dll.pro), then class is dllexport'ed. But when other code uses that same header (in doesn't define SIMPLEDLL_MAKEDLL) then that same class is dllimport'ed instead. Typically, you end up doing this sort of thing to many classes in a single library, so rather than having the #ifdef ... #define ... etc in each header file, it often ends up being written once in a "global" project header of some kind. For example, Q_CORE_EXPORT gets defined in qglobal.h, then used throughout all of the exported core Qt class headers. Also see: When creating a library with Qt/Windows and using it in an application, then there is a link error regarding symbols which are in the library Cheers.