How to Link Imagemagick library to Qt(windows)
-
I have developed an application with mac and for one month now, Im trying to link Qt with ImageMagick on windows. I just cant find the files and the version of Imagemagick library that need to be linked to Qt in order to make my application work on windows. I have tried most of the libraries from http://www.imagemagick.org/script/binary-releases.php Thats the only thing I added to the .pro file while I was developing on a mac INCLUDEPATH += . /opt/local/include/ImageMagick LIBS += -L/opt/local/lib -lMagick++ When I add this to my .pro INCLUDEPATH += C:/im6/include/ImageMagick LIBS += C:/im6/lib/libMagickWand.a LIBS += C:/im6/lib/libMagick++.a LIBS += C:/im6/lib/libMagickCore.a C:/im6/lib/libMagick++.a I get 10.000 + simmilar errors to that: (Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4157: undefined reference to `__gxx_personality_sj0' C:/im6/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4157: undefined reference to `_Unwind_SjLj_Register' C:/im6/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4178: undefined reference to `_Unwind_SjLj_Unregister' For more errors check http://stackoverflow.com/questions/4415778/imagemagick-linking-to-qt-and-mingw32-make-debug-error-2 Has anyone tried to build and deploy an ImageMagick application using qt on windows ? Which files do I need to link while building and which files while deploying ?
-
Answer:
I have found that the minGW tool set is very much treated as a "stepchild" in the Windows world. I know it doesn't help your particular situation, but we had numerous problems with third-party libs while trying to use Qt with minGW. There were always extra steps, or non-existent build instructions that we had to figure out or tweak. Once we switched to the MSVC version, all of those problems went away. Note that this doesn't mean you have to use Visual Studio (you can still use Qt creator), it just means that the Visual Studio compiler is being used. You can get the compiler for free using the Platform SDK. If this is an option, you might save yourself a lot of pain by switching now. It's unfortunate, but that is just the current status quo, at least as we discovered.
Sharethefun at Stack Overflow Visit the source
Other answers
The error message tells me that you use mingw (with qtcreator). Your library might not work with this compiler. You need a mingw version of the library, probably named libmagick.a. LIBS += -L$$quote(c:/Program Files/ImageMagick-6.6.5-Q16/lib) -lmagick (see the documentation about http://doc.trolltech.com/latest/qmake-project-files.html
hmuelner
Please go get ImageMagick source package. I can’t give direct instructions how to work with MinGW of Qt Creator, but basically following. I prefer to use qtvars.bat that comes with binary distributions of Qt to set environment. Open Windows cmd Set PATH to have /path/to/mingw/bin and /path/to/qt/bin before other paths Go to directory where you have extracted ImageMagick source read README, INSTALL and such to compile the ImageMagick (most likely just ./configure ; mingw32-make, but never be sure) Edit your .pro file with something like LIBS += -L$$quote(/path/to/imagemagick/lib/dir) -lmagick . The lib may be in bin dir or in lib dir. See hmuelner’s answer for more information. At this point, the configuration should be ready. Compilation at Qt Creator should work, but you can as well use this cmd windows to compile your program: go to program directory, run “qmake†and “mingw32-makeâ€.
Smar
You cannot link against a ImageMagick++ library built with MSVC, as mingw and MSVC DLLs are incompatible for C++ libraries. You can't link a MSVC-built C++ library into a mingw project, nor vice versa. C-only libraries work fine. Also, according http://www.qtcentre.org/threads/29506-Compilation-problems-with-MinGW, using builds against old mingw-versions with current mingw versions doesn't work as the exception handling changed (as you get more errors than that, I wouldn't expect that to be the only problem though). If there is no binary package for your mingw version (and I don't see any on the imagemagick website), your only option is to use a source package, as Smar suggests. Another option of course is to install Visual Studio, download Qt for MSVC and build your project with MSVC.
Frank Osterfeld
Related Q & A:
- How to link the Javadoc of a Library in Eclipse?Best solution by Stack Overflow
- How to Link Another Static Library to my Static Library in XCode?Best solution by Stack Overflow
- How to draw something in widget(qt?Best solution by Stack Overflow
- What is Android studio library, how to add specific library and use it with my project?Best solution by stackoverflow.com
- How to link static library to QT creator project properly?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.