[Qt-creator] [qt-creator] custom plugin using debugger compilation error

ogre up orgeup at gmail.com
Fri Mar 8 00:28:08 CET 2024


Hi all,
I want to implement a qt creator plug-in that can read specified variables
(such as a vector with more elements) from the debugger, and then export
the variable values to a text file.

Currently, simple sample plug-ins can be compiled and loaded according to
the qt creator wizard (using qt creator 4.12.4/Qt 5.14.2/vs2017 build
tools), but when trying to use the Debugger class, a compilation error will
appear, prompting an unresolved external symbol. I tried adding a
dependency on debugger in the pro file, but it didn't seem to have any
effect.

complier error message as follows:
example.obj : error LNK2019: Unresolved external symbol "public: static
class QPointer<class Debugger::Internal::DebuggerEngine> __cdecl
Debugger::Internal::EngineManager::currentEngine(void)"
(?currentEngine at EngineManager@Internal @Debugger@
@SA?AV?$QPointer at VDebuggerEngine@Internal at Debugger@@@@XZ), this symbol is
in the function "private: void __cdecl
Example::Internal::ExamplePlugin::triggerAction(void)" (?triggerAction@
Referenced in ExamplePlugin at Internal@Example@@AEAAXXZ)
..\..\..\..\Qt\qtcreator-4.12.4\lib\qtcreator\plugins\Example4.dll : fatal
error LNK1120: 1 unresolved external command


some of the source code as follows:
void ExamplePlugin::triggerAction()
{
    QMessageBox::information(Core::ICore::mainWindow(),
                             tr("Action Triggered"),
                             tr("This is an action from Example."));

    Debugger::Internal::DebuggerEngine *engine =
Debugger::Internal::EngineManager::currentEngine();
    if (engine)
    {
        // try fetch variable by name, and dump it's values to text file ...
    }
}

and lib dependency settings in pro file:
--------------------------------------------
QTC_PLUGIN_NAME = Example
QTC_LIB_DEPENDS += \
    # nothing here at this time

QTC_PLUGIN_DEPENDS += \
    coreplugin \
    debugger \
    projectexplorer

QTC_PLUGIN_RECOMMENDS += \
    # optional plugin dependencies. nothing here at this time
--------------------------------------------------------------------------
I would like to know:
1. How to solve the above compilation error?
2. To achieve the function I want, what code snippets can I refer to?

Any suggestion would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20240308/3ede141a/attachment.htm>


More information about the Qt-creator mailing list