Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unresolved externals when building using custom widget

    General and Desktop
    2
    4
    3133
    Loading More Posts
    • 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
      hirumon last edited by

      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 Reply Quote 0
      • G
        goetz last edited by

        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 Reply Quote 0
        • H
          hirumon last edited by

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

          1 Reply Last reply Reply Quote 0
          • H
            hirumon last edited by

            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 Reply Quote 0
            • First post
              Last post