Docs: compiling MagickWand
Posted: 2014-08-03T07:29:50-07:00
The MagickWand API page says:
I don't know if this is a Cygwin issue, or common to all Gnu compilers, or whatever.
Thanks.
Please consider adding after that, the following:After you write your MagickWand program, compile it like this:Code: Select all
$ cc -o wand `pkg-config --cflags --libs MagickWand` wand.c
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.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 don't know if this is a Cygwin issue, or common to all Gnu compilers, or whatever.
Thanks.