Results 1 to 11 of 11

Thread: 0xc0000005 when linking against lib

  1. #1
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 0xc0000005 when linking against lib

    I'm currently doing a exercise of the OopDocbook:
    http://cartan.cas.suffolk.edu/moin/O...taobjects.html
    (free registration required to view this)

    I created a very simple PetManager (as described in the example) - and link this to libdataobjects. (download here: http://cartan.cas.suffolk.edu/oopdocbook/dist/)

    From my pro-file:
    INCLUDEPATH += d:\qt\libs\dataobjects
    win32:LIBS += d:\qt\libs\libdataobjects.a
    (i complied libdataobjects.a myselfe)

    ....when i now use the DataObject-Class from libdataobjects compiling and linking works fine, but the compiled application exits with: "Can't initialize the Application (0xc0000005)."

    I found out that this stands for Permission denied. But what does that mean?



    When I don't use Q_OBJECT in the class that inherits DataObject everything works fine (but i can't use signal/slots etc then ofcourse)



    please help!

    (PS: I'm on Win2k, Qt4.1, MinGW)

  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: 0xc0000005 when linking against lib

    Quote Originally Posted by niko
    When I don't use Q_OBJECT in the class that inherits DataObject everything works fine (but i can't use signal/slots etc then ofcourse)
    Did you run qmake to get a new Makefile after adding Q_OBJECT?

  3. #3
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when linking against lib

    thanks for the reply,
    Did you run qmake to get a new Makefile after adding Q_OBJECT?
    yes i did.

  4. #4
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when linking against lib

    Some more information I found out:
    - When i start the debugger and make exactly one step-into the application quits with the same error-message.

    - when i don't link to libdataobjects but instead copy the source-files of the used classes to my application everything works fine
    (so i assume it's a problem with the linking...)

  5. #5
    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: 0xc0000005 when linking against lib

    Did you compile that library in release or debug mode? Do you use the same mode for your application?

  6. #6
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when linking against lib

    i did build both in debug mode.

    and tried both in release-mode too - doesn't help.

  7. #7
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when linking against lib

    I attached my files, perhaps someone would like to help and see if he can reproduce the problem
    (or - better - tell me what i'm making wrong)

    steps to reproduce:
    Qt Code:
    1. unpack attached zip
    2. set CPPLIBS=absolutepath to libs-dir (used by qmake-scripts)
    3. cd libs
    4. qmake
    5. make
    6. cd ..
    7. cd PetManager
    8. qmake
    9. make
    10. debug\PetManager
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

  8. #8
    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: 0xc0000005 when linking against lib

    Quote Originally Posted by niko
    I attached my files, perhaps someone would like to help and see if he can reproduce the problem
    I think it works:
    ohje
    "
    <object class="PetList" name="" >

    <object class="Pet" name="" >
    <property name="Type" type="QString" value="Kuh" />
    <property name="Breed" type="QString" value="Schwarzbunt" />
    <property name="Name" type="QString" value="Serena" />
    <property name="ID" type="int" value="20" />
    <property name="Birthday" type="QDate" value="2001-02-12" />

    <object class="Maintenance" name="" >
    <property name="Event" type="QString" value="Klauen schneiden" />
    <property name="Date" type="QDate" value="2006-01-12" />
    <property name="Cost" type="int" value="100" />
    </object>

    </object>

    </object>
    "
    Hallo
    (I use PLD Linux and Qt 4.1.1).

    Did you buld those libraries as static ones or as DLLs? Did you try to copy all DLLs to the directory where your executable is?

  9. #9
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when linking against lib

    much thanks for testing!
    (how bad it works for you... probably only a problem on win32?)

    [qoute]Did you buld those libraries as static ones or as DLLs? Did you try to copy all DLLs to the directory where your executable is?[/quote]
    as dll (the standard-behaviour)

    ...and yes - i copied the dlls into the direcotory.

  10. #10
    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: 0xc0000005 when linking against lib

    Quote Originally Posted by niko
    probably only a problem on win32?
    Yes, I just checked the sources and all classes are declared like this:
    Qt Code:
    1. class DataObject : public QObject {
    2. Q_OBJECT
    3. // ...
    4. };
    To copy to clipboard, switch view to plain text mode 
    Which means that they aren't ready for use in DLLs (in short: you can't use those classes outside the DLL, because they're not exported).

    It should be:
    Qt Code:
    1. class EXPORT DataObject : public QObject {
    2. Q_OBJECT
    3. // ...
    4. };
    To copy to clipboard, switch view to plain text mode 
    Where EXPORT macro is either __declspec(dllimport), __declspec(dllexport) or empty. See this thread for more info.

  11. #11
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when linking against lib

    aaah, much thanks for that hint!

    i compiled the libary now static and everything is working just fine!

    big thanks!

Similar Threads

  1. Linking
    By ^NyAw^ in forum General Programming
    Replies: 7
    Last Post: 30th October 2008, 17:37
  2. Static linking of Qt programs
    By divya balachandran in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2008, 12:10
  3. Linking problems with QT4 under Windows
    By Ancalagon in forum Qt Programming
    Replies: 2
    Last Post: 8th September 2008, 13:29
  4. problem with order of libs during linking
    By minimax in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2008, 10:32
  5. Replies: 4
    Last Post: 20th February 2006, 09:11

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.