Cannot find Magick++ header files

℡╲_俬逩灬. 提交于 2019-12-01 21:59:10

Since you are under Linux, I would think you can install the imagemagick package that comes with your installation. It's available on all flavors of Linux I know of.

Under Debian/Ubuntu it would be something like this:

sudo apt-get install libmagick++-dev

Otherwise, I personally would use cmake to do all the setup. It's a bit of a learning curve. But it seems to me that if your command line is:

g++ main.cpp

Then you are missing a couple -I options on your command line. Installing the package may not require you to use the -I option (I use cmake and don't really pay attention to those things... it just works for me.)

So to solve your problem, you probably need something like this:

g++ -I/home/simeon/ImageMagick-6.8.9-0/Magick++/lib main.cpp

If you have a single .cpp file, although, you may want to use a -o myprog command line option.

ImageMagick ships with a configuration utility that should give you the correct path. For Magick++, it's simply Magick++-config (see section Usage in Magick++ docs.)

IM_CXXFLAGS=$(Magick++-config --cxxflags)
IM_LDFLAGS=$(Magick++config --ldflags)
g++ $IM_CXXFLAGS $IM_LDFLAGS main.cpp

You will need to use the system's include statement (<>), and keep it simple by including the parent header.

#include <Magick++.h>

If you just need it for single file, here is the proper build command for a Magick++ module:

g++ `Magick++-config --cxxflags --cppflags` -O2 -Wall -o yourProgramName yourFile.cpp `Magick++-config --ldflags --libs`

If it does not work you may need to install libmagick++-dev first:

sudo apt-get install libmagick++-dev

And install imageMagick from Unix Source:

  1. download ImageMagick-7.0.3-5.tar.gz from here
  2. Install it using instructions from here
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!