Compile errors with Magick++

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cshake

Compile errors with Magick++

Post 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!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Compile errors with Magick++

Post 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.
cshake

Re: Compile errors with Magick++

Post 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.
Post Reply