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

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 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?

  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

    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

  4. #4
    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

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 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

  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

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

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

    Default Re: What am I missing? Unresolved externals

    I even tried:

    Qt Code:
    1. #include <QtCore/qglobal.h>
    2. // Win 32 DLL export macros
    3. #ifdef WIN32
    4. # ifdef BUILD_DLL
    5. //# define XPAF_DLL_EXPORT __declspec(dllexport)
    6. # define XPAF_DLL_EXPORT Q_DECL_EXPORT
    7. # else
    8. # define XPAF_DLL_EXPORT // Empty
    9. # endif
    10. #endif // WIN32
    To copy to clipboard, switch view to plain text mode 
    Derick Schoonbee

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 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

    Are you sure you pinpointed the problem correctly? It looks like your plugin can't resolve a symbol. I know it shouldn't even try to, but... It looks like an overall compiler issue not a Qt one. Try to build any plugin which needs an external dependency (for example one that needs a "foo()" function. When you succeed, you'll come back to Qt. Maybe you lack some compiler option?

  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

    Hmmm... after using:
    Qt Code:
    1. #include <QtCore/qglobal.h>
    2. # define XPAF_DLL_EXPORT Q_DECL_EXPORT
    To copy to clipboard, switch view to plain text mode 

    And the rebuild of the whole planet... one DLL worked .... phew....
    Now to sort out the other...
    It still is the same unresolved symbols so I'll check some defines...
    Derick Schoonbee

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

    Default Re: What am I missing? Unresolved externals

    Sigh ... still no joy...

    When creating a 2nd DLL the imports of the 1st does not work:
    Qt Code:
    1. ezGScreenInterface.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const ezCrm::ezBase::staticMetaObject" (?staticMetaObject@ezBase@ezCrm@@2UQMetaObject@@B)
    To copy to clipboard, switch view to plain text mode 

    ezGScreenInterfac declated in 2nd DLL
    ezBase declared in 1st DLL

    Any idea why teh meta object does not get exported in the 1st DLL?
    Derick Schoonbee

  11. #11
    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

    Quote Originally Posted by derick
    When creating a 2nd DLL the imports of the 1st does not work:
    When you compile code that will use your DLL (not the DLL itself), you need __declspec(dllimport) (in the same place where __declspec(dllexport) was).

  12. #12
    Join Date
    Feb 2006
    Posts
    32
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What am I missing? Unresolved externals

    I sorry, I am having a problem very similar to this, but when reading this thread I keep thinking, shouldn't Qt be abstracting all this?

    Where in the Qt documentation does it say I need to have "dllexport", "dllimport" declarations everywhere?

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
  •  
Qt is a trademark of The Qt Company.