Search code examples
cxcodeframeworksdylibgraphicsmagick

Adding GraphicsMagick to an Xcode project


I have created a Foundation Tool in Xcode, and want to use some functions from the GraphicsMagick image manipulation library. The library has been compiled and installed on my computer using MacPorts. I added libGraphicsMagick.3.dylib and libGraphicsMagickWand.2.dylib to my project as external frameworks.

What other steps must I take to use these libraries in my application, and how would I import their headers to use their functions in my code?

Thanks

UPDATE: Made some progress. Used the .a static libraries instead of the dylibs, added them to my project, then added the header files for magick and wand. I'm trying to compile, but I get this error: alt text http://cl.ly/f4233cddbae23e1a19fc/content


Solution

  • Searched around a bit, and apparently this problem occurs because 2 of the typedef enum declarations that GraphicsMagick and ImageMagick use are already defined in OS X framework headers. The enums in question are ColorInfo and ExceptionInfo.

    The only way to fix it is to go through the source and rename every occurance of those enums to a new name that isn't already taken. However, the iPhone does not have this issue and GraphicsMagick will compile just fine. Unfortunately, I don't think the people behind the library are willing to rename their enums just to get it to compile on OS X.