[SOLVED] Qt Creator: linker error when trying to use TaskHub API



  • I am trying to create custom plugin that will add new issues to Issues pane, however when I am trying to use TaskHub API from built-in ProjectExplorer plugin I get unresolved symbol linker error:

    @
    mypluginplugin.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl ProjectExplorer::TaskHub::addCategory(class Core::Id,class QString const &,bool)" (_imp?addCategory@TaskHub@ProjectExplorer@@SAXVId@Core@@AEBVQString@@_N@Z) referenced in function "public: virtual bool __cdecl MyPlugin::Internal::MyPluginPlugin::initialize(class QStringList const &,class QString *)" (?initialize@MyPluginPlugin@Internal@MyPlugin@@UEAA_NAEBVQStringList@@PEAVQString@@@Z)
    @

    That is how I use it, in my myplugin.cpp:

    @
    #include <projectexplorer/taskhub.h>
    ...
    ProjectExplorer::TaskHub::addCategory(
    Core::Id("Unit tests"),
    QLatin1String("Unit tests"));
    ...
    @

    My .pro file:
    @

    QTC_PLUGIN_DEPENDS +=
    coreplugin
    projectexplorer
    @

    I have checked out latest source code of qt creator from the repository, built it and my custom plugin works if I use only api from coreplugin, but I get linker error for everything else.



  • I solved the problem by adding:
    @
    QMAKE_CFLAGS += $$QMAKE_CFLAGS_MT
    QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_MT
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.