Page 1 of 1

Docs: compiling MagickWand

Posted: 2014-08-03T07:29:50-07:00
by snibgo
The MagickWand API page says:
After you write your MagickWand program, compile it like this:

Code: Select all

$ cc -o wand `pkg-config --cflags --libs MagickWand` wand.c
Please consider adding after that, the following:
Some compiler toolsets (such as Cygwin) require the source code before the pkg-config, like this:

Code: Select all

$ cc -o wand wand.c `pkg-config --cflags --libs MagickWand`
I spent a couple of days figuring this out. When the .c file is placed at the end, the linker command puts the object file after the libraries, resulting in many "undefined reference" errors. Placing the .c file before pkg-config cures the errors.

I don't know if this is a Cygwin issue, or common to all Gnu compilers, or whatever.

Thanks.

Re: Docs: compiling MagickWand

Posted: 2014-08-03T07:34:49-07:00
by magick
Thanks for the suggestion, allow up to 24 hours for the web-site patch to mirror world-wide.

Re: Docs: compiling MagickWand

Posted: 2014-08-04T02:12:22-07:00
by snibgo
Thanks.

For anyone venturing into this territory, I have described my experience of building IM and the demonstration programs under Cygwin, in pages on my site. Although I fell into a few traps along the way, the process turns out to be quick and simple.