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. Unresolved externals when building using custom widget
QtWS25 Last Chance

Unresolved externals when building using custom widget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.3k Views
  • 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.
  • H Offline
    H Offline
    hirumon
    wrote on last edited by
    #1

    Hi,
    I am new to -QT- Qt programming.. I wanted to try creating a custom widget..
    I created a sample one which just shows a rectangle using paintEvent function..
    I added the control to Qt designer.. and it shows up fine..

    The problem im facing is that when i tried created a test app by just adding the custom contol..when i build it the following error comes.. I have added the lib fies to the project properties.. still this comes.. pls help me..
    @Error 2 error LNK2019: unresolved external symbol "public: __thiscall CustomWgtApp::CustomWgtApp(class QWidget *)" (??0CustomWgtApp@@QAE@PAVQWidget@@@Z) referenced in function "public: void __thiscall Ui_TestAppClass::setupUi(class QMainWindow *)" (?setupUi@Ui_TestAppClass@@QAEXPAVQMainWindow@@@Z) C:\Users\Bhadran\Documents\Visual Studio 2010\Projects\CustomWgtApp\TestApp\testapp.obj TestApp
    @
    @Error 3 error LNK1120: 1 unresolved externals C:\Users\Bhadran\Documents\Visual Studio 2010\Projects\CustomWgtApp\TestApp.exe TestApp
    @

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      you need to incorporate the object code of your custom widget. Either by linking it as a library or by adding the source files to your project.

      The Designer plugin does not add the code for you, it just makes it available in the graphical design tool.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hirumon
        wrote on last edited by
        #3

        Thank you for your reply.. I have tried linking the lib file also.. Still the problem persists..

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hirumon
          wrote on last edited by
          #4

          It works when adding source files to my app.. Must be some problem with the way i created lib file i guess..

          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