Compiling a C++ Library dependent on Magick++ in Windows

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Jaws
Posts: 2
Joined: 2011-01-18T23:55:31-07:00
Authentication code: 8675308

Compiling a C++ Library dependent on Magick++ in Windows

Post by Jaws »

I have written a C++ library which I use for various parts of a project I've been working in on for a while. I am mostly (or almost exclusively) a Linux user but for the sake of others, I'm trying to compile this library on Windows. I've been trying to compile it using the GNU GCC on windows as provided by MinGW (+MinGW-make). I've tried working both through the Eclipse CDT on which this was developed, and compiling straight from command line.

I've added the ImageMagick/include path to the include path (-I) and it seems to find the functions and compile happily.
However, once it tries to link it does not seem to find the Magick++ functions in the libraries.

I did see that compiling on Windows requires initialization of the library in the following manner (http://www.imagemagick.org/Magick++/):

Code: Select all

 int main( ssize_t /*argc*/, char ** argv)
    {
      InitializeMagick(*argv);
which would work if I had a main method, but since I'm trying to compile a library, I don't have a main method or argv passed to it.

I've added the ImageMagick path to the library path (-L)
It does not recognize -lMagick++ as it does on my Linux box, although I'm not surprised since usually you have to put the full dll name. So I've tried adding -lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_ -lX11 and it find the libraries (or at least stops complaining about not finding them) but can't link any of the functions resulting in tons of "undefined reference" errors.

I was wondering if any one could enlighten me about how to go about this problem...
Jaws
Posts: 2
Joined: 2011-01-18T23:55:31-07:00
Authentication code: 8675308

Re: Compiling a C++ Library dependent on Magick++ in Windows

Post by Jaws »

I may be able to get around this problem if I could compile the library using MinGW, not through a POSIX environment (Cygwin/MSSYS). However, I'm not sure how to do so either as there are only instructions on how to compile from source using visual studio (http://www.imagemagick.technocozy.com/w ... ml#windows).
Does anyone know how to compile the gcc dlls?
Post Reply