Page 1 of 1

Compile errors with Magick++

Posted: 2009-11-20T16:07:10-07:00
by cshake
I've got a program written in C++ where I'm generating the color of each pixel mathematically, then writing the image. I figured that Magick++ was the simplest way to do this, so I looked up the API and tried to compile the program. However, it's throwing lots of errors that make it look like the `Magick++-configure ...` line isn't working in gcc, and I don't know why.

Environment: Arch Linux, 'imagemagick 6.5.7.5-1' installed with the package manager. ImageMagick functions work fine from the PHP interface on my webserver.

Command: >$ g++ `Magick++-config --cppflags --cxxflags --ldflags --libs` -o program program.cpp -fopenmp

Error: I get a printout of 'Usage' instructions for Magick++, which basically repeat back to me what I've put in the ` ` line. Then I get all sorts of undefined references to Magick functions that indicate it isn't being built with the library. Ex. "undefined reference to `Magick::Color::~Color()' "

As a note, none of the calls to the Magick++ functions are in threaded blocks, only my generation code is.

Does anyone have any ideas for what I can do to fix this?
Thanks!

Re: Compile errors with Magick++

Posted: 2009-11-20T19:46:15-07:00
by magick
This is the command we use:
  • g++ `Magick++-config --cxxflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
If that fails, type
  • Magick++-config --cxxflags --cppflags
and
  • Magick++-config --ldflags --libs
to see which options Magick++ is using. Perhaps there is a missing option when it comes to Arch Linux.

Re: Compile errors with Magick++

Posted: 2009-11-20T20:11:33-07:00
by cshake
magick wrote:This is the command we use:
  • g++ `Magick++-config --cxxflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
Thanks, that lets it compile. I still get the echo of the 'usage instructions' for Magic++-config, but no errors and the program works.