Important: Please read the Qt Code of Conduct -

Custom Widget and #include error in the ap

  • Hi all.
    I build my custom widget XLabel, derived from a QLabel.
    I create and I use it in Designer.

    When I compile the project the linker cannot find XLabel::XLabel because it is implemented in

    How can I tell to the linker to link libxlabelplugin?

    This is the tree of the project

  • Lifetime Qt Champion


    You followed the "simple way" of creating a Designer plugin.

    For a "real world" approach take a look at this.

    Short version: you split your plugin code in two:

    1. a library which will include your widget(s)
    2. the plugin itself

    That way you have the plugin for designer and you can link your application to the library which will not have any dependency on designer related code.

    Hope it helps