Results 1 to 3 of 3

Thread: [Qt 4.4 + Eclipse] My QT lib makes me crash ( 0xc0000005 )

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default [Qt 4.4 + Eclipse] My QT lib makes me crash ( 0xc0000005 )

    Hey there,

    I'm starting a new project built around the following approach:

    LIB_ITEM - A QT library of widgets.
    CORE_PROGRAM - The Core of the program using that Qt library.

    * Inside of my LIB_ITEM I have a widget declared as qtBox, it does nothing except having a ctor + dtor.
    * Inside of my CORE_PROGRAM I declare a widget which inherits of qtBox.

    Now, for some reason when running my CORE_PROGRAM :

    -> If I provide the lib DLL, I get a crash before the main is even reached.
    -> If I don't provide the lib DLL, I get a symbol's missing crash.
    -> If I don't inherit and use the lib, it doesn't crash.

    What bugs me is the fact that even if I don't do anything in my main, the program still crashes when linked to my LIB_ITEM.

    Any idea ?
    Last edited by bunjee; 13th August 2008 at 17:57.

  2. #2
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: [Qt 4.4 + Eclipse] My QT lib makes me crash

    I tried to run the app out of the Eclipse environment,
    I'm getting this on Windows :

    Application error:
    The application cannot execute ( 0xc0000005 )

    and then a Segfault.

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: [Qt 4.4 + Eclipse] My QT lib makes me crash

    Solved.

    This is a Windows specific issue.
    Each DLL Classes needs to exported during the DLL build.
    Each DLL Classes needs to be imported during your program's build.

    You have to proceed this way :

    In my Lib project:

    In my lib global header :
    Qt Code:
    1. #ifdef CUTE_TOOLKIT_DLL // Replace by your own DEFINE
    2. # define EXPORT Q_DECL_EXPORT
    3. #else
    4. # define EXPORT Q_DECL_IMPORT
    5. #endif
    To copy to clipboard, switch view to plain text mode 

    (you could use __declspec(dllimport), __declspec(dllexport))

    In my lib widget classes :
    Qt Code:
    1. class EXPORT qkBox : public QWidget
    2. {
    3. Q_OBJECT
    4. //...
    To copy to clipboard, switch view to plain text mode 

    In my lib pro file :
    Qt Code:
    1. DEFINES += CUTE_TOOLKIT_DLL
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Gnome makes application crash
    By regix in forum Qt Programming
    Replies: 35
    Last Post: 18th August 2006, 19:44

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.