Unresolved externals when building using custom widget



  • 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
    @



  • 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.



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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.