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

Eike Ziller Eike.Ziller at qt.io
Fri Mar 15 09:04:34 CET 2024


Hi,

> qtcreator-4.12.4

As a side note, you should probably not start developing a plugin for that old version of Qt Creator.

>     Debugger::Internal::DebuggerEngine *engine = Debugger::Internal::EngineManager::currentEngine();

EngineManager is internal (as can be seen from the namespace), and the symbol is not exported to other plugins/libraries.
I do not think that the Debugger plugin allows the kind of interaction that you want from it.

Br, Eike

> Am 08.03.2024 um 00:28 schrieb ogre up <orgeup at gmail.com>:
> 
> 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.
> -- 
> Qt-creator mailing list
> Qt-creator at qt-project.org
> https://lists.qt-project.org/listinfo/qt-creator

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Erich-Thilo-Str. 10
12489 Berlin, Germany
eike.ziller at qt.io
https://qt.io

Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B




More information about the Qt-creator mailing list