Results 1 to 2 of 2

Thread: Using Imagemagick lib

  1. #1
    Join Date
    Sep 2012
    Posts
    34
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Using Imagemagick lib

    Hi,

    I've been trying to get Imagemagick working in my Qt project. Because I'm using MinGW compiler, I had to build the Imagemagic lib myself. I followed these instructions: http://imagemagick.sourceforge.net/h...w/install.html

    My .pro file looks like this:

    Qt Code:
    1. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
    2. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
    3. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
    4. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
    5. LIBS += -Lc:/MinGW/lib -llibMagickWand-6.Q16 -llibMagickCore-6.Q16
    To copy to clipboard, switch view to plain text mode 

    I have added headers to .cpp and it seems to work:

    Qt Code:
    1. #include <Magick++.h>
    To copy to clipboard, switch view to plain text mode 

    Then I have tried to copy the related 'dll' and 'a' files under mingw/lib and the application directory.

    Problem is that it gives following errors when building the project:

    Qt Code:
    1. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Offset (484) greater than or equal to (null) size (4954657).
    2. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x20): undefined reference to `EnterCriticalSection@4'
    3. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '0', this reader only handles version 2 and 3 information.
    4. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x61): undefined reference to `LeaveCriticalSection@4'
    5. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '20039', this reader only handles version 2 and 3 information.
    6. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0xb5): undefined reference to `EnterCriticalSection@4'
    7. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '8259', this reader only handles version 2 and 3 information.
    8. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0xd0): undefined reference to `LeaveCriticalSection@4'
    9. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '11829', this reader only handles version 2 and 3 information.
    10. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x104): undefined reference to `EnterCriticalSection@4'
    11. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '11777', this reader only handles version 2 and 3 information.
    12. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x133): undefined reference to `LeaveCriticalSection@4'
    13. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '26989', this reader only handles version 2 and 3 information.
    14. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x156): undefined reference to `LeaveCriticalSection@4'
    15. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '12151', this reader only handles version 2 and 3 information.
    16. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x1af): undefined reference to `DeleteCriticalSection@4'
    17. c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: Dwarf Error: found dwarf version '29811', this reader only handles version 2 and 3 information.
    18. c:/MinGW/lib/libmingw32.a(tlsthrd.o):tlsthrd.c:(.text+0x1dc): undefined reference to `InitializeCriticalSection@4'
    19. collect2: ld returned 1 exit status
    20. mingw32-make.exe[1]: *** [debug\barcode_reader_from_image.exe] Error 1
    21. mingw32-make.exe: *** [debug] Error 2
    22. 09:47:54: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
    23. Error while building project barcode_reader_from_image (target: Desktop)
    24. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

    Any idea what is causing the errors? By googling I found some comments that some other libs should also be added, but at least these did not make any change:

    Qt Code:
    1. LIBS += c:/MinGW/lib/libkernel32.a
    2. LIBS += c:/MinGW/lib/libgdi32.a
    To copy to clipboard, switch view to plain text mode 


    On the other hand, if I do not put the -Lc:/MinGW/lib to the .pro file (only the two libraries), it seems that the added libraries are not found:

    .pro:
    Qt Code:
    1. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
    2. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
    3. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
    4. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
    5. LIBS += c:/MinGW/lib/libMagickCore-6-Q16.a
    6. LIBS += c:/MinGW/lib/libMagickWand-6-Q16.a
    To copy to clipboard, switch view to plain text mode 

    Then trying to use the libraries in source:

    Qt Code:
    1. Magick::Image magick;
    To copy to clipboard, switch view to plain text mode 

    build error:

    Qt Code:
    1. debug/mainwindow.o:C:\Users\Aki\barcode_reader_from_image-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../barcode_reader_from_image/mainwindow.cpp:49: undefined reference to `Magick::InitializeMagick(char const*)'
    2. collect2: ld returned 1 exit status
    3. mingw32-make.exe[1]: *** [debug\barcode_reader_from_image.exe] Error 1
    4. mingw32-make.exe: *** [debug] Error 2
    5. 10:41:12: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
    6. Error while building project barcode_reader_from_image (target: Desktop)
    7. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

    Don't know anymore what to try. Any help is higly appreciated! Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using Imagemagick lib

    Quote Originally Posted by Mobility View Post
    Hi,

    I've been trying to get Imagemagick working in my Qt project. Because I'm using MinGW compiler, I had to build the Imagemagic lib myself. I followed these instructions: http://imagemagick.sourceforge.net/h...w/install.html

    My .pro file looks like this:

    Qt Code:
    1. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include"
    2. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/magick"
    3. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/Magick++"
    4. INCLUDEPATH += "C:/ImageMagick-6.8.8-Q8/include/wand"
    5. LIBS += -Lc:/MinGW/lib -llibMagickWand-6.Q16 -llibMagickCore-6.Q16
    To copy to clipboard, switch view to plain text mode 
    Your LIBS line is missing the -L directive for the ImageMagick library directory.
    Probably something like
    Qt Code:
    1. -LC:/ImageMagick-6.8.8-Q8/lib
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 9th January 2012, 08:20
  2. speed up my imagemagick/qt editor
    By yoniekai in forum Qt Programming
    Replies: 5
    Last Post: 5th April 2011, 13:15
  3. Replies: 0
    Last Post: 11th November 2009, 16:09
  4. ImageMagick and QT
    By manojmka in forum Qt Programming
    Replies: 16
    Last Post: 10th April 2008, 15:30
  5. Qt + ImageMagick
    By bpetty in forum Newbie
    Replies: 8
    Last Post: 23rd April 2007, 22:08

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.