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!