Results 1 to 20 of 50

Thread: What am I missing? Unresolved externals

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy What am I missing? Unresolved externals

    Hi,

    In porting to Qt4 I'm finally linking but run into unresolved externals:

    Qt Code:
    1. link /LIBPATH:"C:\Qt\4.0.1\lib" /NOLOGO /DEBUG /DEBUG /DLL /LIBPATH:../xpaf /LIBPATH:../xpaf xpaf-sdk.lib /LIBPATH:..
    2. /xpaf-sdk/debug /LIBPATH:../../lua-5.0.2/lib ../../lua-5.0.2/lib\lualib.lib C:\Qt\4.0.1\lib\QtCored4.lib C:\Qt\4.0.1\lib\QtGu
    3. id4.lib C:\Qt\4.0.1\lib\Qt3Supportd4.lib C:\Qt\4.0.1\lib\QtSqld4.lib C:\Qt\4.0.1\lib\QtXmld4.lib /OUT:"debug\xpaf-sdkgui.dll"
    4. @C:\temp\nmCE6.tmp
    5. Creating library debug\xpaf-sdkgui.lib and object debug\xpaf-sdkgui.exp
    6. moc_ezSessionApp.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const ezCrm::ezBase::stat
    7. icMetaObject" (?staticMetaObject@ezBase@ezCrm@@2UQMetaObject@@B)
    8. ...
    9. ...
    10. ezModelGui.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const layerModel::ezBCModel_RTa
    11. ble_Control::staticMetaObject" (?staticMetaObject@ezBCModel_RTable_Control@layerModel@@2UQMetaObject@@B)
    12. debug\xpaf-sdkgui.dll : fatal error LNK1120: 59 unresolved externals
    13. NMAKE : fatal error U1077: 'link' : return code '0x460'
    14. Stop.
    15. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Bin\nmake.exe"' : return code '0x2'
    16. Stop.
    To copy to clipboard, switch view to plain text mode 

    I have
    Qt Code:
    1. // Win 32 DLL export macros
    2. #ifdef WIN32
    3. # ifdef BUILD_DLL
    4. # define XPAF_DLL_EXPORT __declspec(dllexport)
    5. # else
    6. # define XPAF_DLL_EXPORT // Empty
    7. # endif
    8. #endif // WIN32
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. namespace layerModel {
    2.  
    3. class XPAF_DLL_EXPORT ezBCModel_RItem: public ezBCModelBase
    4. {
    5. Q_OBJECT
    6. public:
    7. ezBCModel_RItem(ezModelRender *aParent, QString aName=0);
    8. ~ezBCModel_RItem(void);
    9. };
    10. ...
    11. namespace layerModel {
    12. ..
    13. class XPAF_DLL_EXPORT ezBCModel_RTable: public ezBCModel_RItem
    14. {
    15. Q_OBJECT
    16. public:
    17. ezBCModel_RTable(ezModelRender *aParent, QString aName=0);
    18. ~ezBCModel_RTable(void);
    19. };
    To copy to clipboard, switch view to plain text mode 

    What am I missing? Namepace messing the name mangling
    DLL_EXPORT

    Any pointers appreciated!!
    Derick Schoonbee

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What am I missing? Unresolved externals

    Does appropriate moc_*.cpp file contains the definition of layerModel::ezBCModel_RTable_Control::staticMetaOb ject?

  3. #3
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What am I missing? Unresolved externals

    In moc_ezBCModel_RTable.cpp:
    Qt Code:
    1. const QMetaObject layerModel::ezBCModel_RTable_Control::staticMetaObject = {
    2. { &ezBCModel_RItem_Control::staticMetaObject, qt_meta_stringdata_layerModel__ezBCModel_RTable_Control,
    3. qt_meta_data_layerModel__ezBCModel_RTable_Control, 0 }
    4. };
    To copy to clipboard, switch view to plain text mode 
    Derick Schoonbee

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What am I missing? Unresolved externals

    Do you link your application with moc_ezBCModel_RTable.obj?

  5. #5
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What am I missing? Unresolved externals

    Yup.. it gets linked into the DLL:

    Qt Code:
    1. Creating temporary file "C:\temp\RSP00007A.rsp" with contents
    2. [
    3. /OUT:"debug\xpaf-sdk.dll" /NOLOGO /LIBPATH:"C:\Derick\projects\xpaf\xpaf-sdk\debug" /LIBPATH:"C:\Qt\4.0.1\lib" /DLL /DEBUG /SUBSYSTEM:WINDOWS /LIBPATH:../xpaf /LIBPATH:../xpaf /LIBPATH:../../lua-5.0.2/lib ../../lua-5.0.2/lib\lualib.lib C:\Qt\4.0.1\lib\QtCored4.lib C:\Qt\4.0.1\lib\QtGuid4.lib C:\Qt\4.0.1\lib\QtSqld4.lib C:\Qt\4.0.1\lib\QtXmld4.lib C:\Qt\4.0.1\lib\Qt3Supportd4.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
    4. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBBase.obj"
    5. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCAucLot.obj"
    6. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCBase.obj"
    7. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCContact.obj"
    8. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCModel_BC.obj"
    9. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCModel_DTable.obj"
    10. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCModel_Entity.obj"
    11. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCModel_RItem.obj"
    12. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCModel_RScreen.obj"
    13. "\Derick\projects\xpaf\tmp\xpaf-sdk\ezBCModel_RTable.obj"
    To copy to clipboard, switch view to plain text mode 
    Derick Schoonbee

  6. #6
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What am I missing? Unresolved externals

    Found something:

    After undefining XPAF_DLL_EXPORT the unresolved externals went away...

    Is there a difference in Qt4? I think I read somewhere that the moc now understands macro expantions....
    Derick Schoonbee

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What am I missing? Unresolved externals

    Does that class of yours inherit QObject?

  8. #8
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What am I missing? Unresolved externals

    Yes they do.

    When I build the DLL my classes are not exported. I even tried to export my classes with:

    # define XPAF_DLL_EXPORT Q_DECL_EXPORT
    and
    # define XPAF_DLL_EXPORT __declspec(dllexport)

    Anything that I should try with QT4?
    Derick Schoonbee

  9. #9
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What am I missing? Unresolved externals

    Does anybody have some sample classes exported in external DLLs? Please

    My code compiles but I get an error as my DLL does not show the exported classes. Or do we need to load DEF files?
    Derick Schoonbee

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What am I missing? Unresolved externals

    Check Qt4 sources

  11. #11
    Join Date
    Jan 2006
    Location
    France
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What am I missing? Unresolved externals

    Maybe a more specific hint .. I only found some specific macros for plugins.
    Derick Schoonbee

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  2. shared vs static
    By alisami in forum Installation and Deployment
    Replies: 3
    Last Post: 4th October 2008, 13:04
  3. Replies: 16
    Last Post: 23rd May 2008, 10:12
  4. link error for visual studio.net 2003
    By berlin in forum Newbie
    Replies: 9
    Last Post: 29th September 2006, 16:06
  5. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.