Docs: compiling MagickWand

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Docs: compiling MagickWand

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Docs: compiling MagickWand

Post by magick »

Thanks for the suggestion, allow up to 24 hours for the web-site patch to mirror world-wide.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Docs: compiling MagickWand

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply