Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't use custom widget, error: undefined reference to `Custom widget
Forum Updated to NodeBB v4.3 + New Features

Can't use custom widget, error: undefined reference to `Custom widget

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M001
    wrote on last edited by
    #1

    hello,
    I build a custom widget for QT Designer. This custom widget now shows up in the QTDesigner Widgetbox and I could drag and drop it into my ui.
    Here is the problem:
    when I start compiling my code, there is an error undefined reference to `Custom widget. I include the .h-File of the Plugin and it seams that the linkt to the sources of my plugin are missing. so I included the .dll File of the Pluging in the .pro File LIBS += "D:/Test/customwidget.dll". but I still get the same error. Whats wrong and how can I fix this error.
    Tanks for your help :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You don't link against a DLL on windows but a lib file, that was generated when you compiled the plugin.

      You should have something like

      @LIBS += -lcustomwidget@

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M001
        wrote on last edited by
        #3

        okay the name of my custom widget is MyLabel, but when I add
        @LIBS += -lmylabelget@
        there is an error:
        cannot find -mylabelget. when I write:
        @LIBS += -LMyLabelget@
        there is no cannot find ...
        but then again there is the other error undefinde reference to

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          Hi,

          At first, Do you have the MyLabelget.dll and MyLabelget.lib exist or not before your create the designer plugin?

          If not, you should add xxxx.h and xxxx.cpp to your .pro file directly.


          By the way, please not that, the designer plugin has nothing to do with your application, it only make sense when you design your ui.

          Normally, if you want to create a library for custom widgets, you should create the library first. then create a designer plugin which depending on the first library. The plugin is optional.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            M001
            wrote on last edited by
            #5

            when I build my custom widget I get a .dll and a .lib file. where do i have to copy these two files, to make the plugin work correctly?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Just to be sure: Do you have a library containing your widget and another containing your Designer plugin ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved