Page 1 of 1

Setting up Magick++

Posted: 2007-10-30T02:32:14-07:00
by Granite
Hi,

I'm trying to get my first Magick++ code to compile and work. It just loads an image, and then prints an 'ok' message .

I finally got it to compile using the following line:
g++ -o main main.cpp `Magick++-config --cppflags --cxxflags --ldflags --libs`
which I find quite obscure (any hints on how to use exactly Magick++-config ?)

Now when i run ./main, i get the following error message:
./main: error while loading shared libraries: libMagick++.so.10: cannot open shared object file: No such file or directory
although i do have the file:
$ locate libMagick++.so.10
/home/inca/software/ImageMagick-6.3.2/Magick++/lib/.libs/libMagick++.so.10
/home/inca/software/ImageMagick-6.3.2/Magick++/lib/.libs/libMagick++.so.10.0.7
/home/inca/software/ImageMagick-6.3.2/Magick++/lib/.libs/libMagick++.so.10.0.7T
/usr/local/lib/libMagick++.so.10
/usr/local/lib/libMagick++.so.10.0.7
$ whereis libMagick++.so.10
libMagick++.so: /usr/local/lib/libMagick++.so /usr/local/lib/libMagick++.so.10
Any ideas why it won't find it?

edit: I thought I was posting in the 'Users' board, sorry about that...

Re: Setting up Magick++

Posted: 2007-10-30T06:15:44-07:00
by magick
The proper compile command is:
  • g++ `Magick++-config --cflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
You may also need to set the LD_LIBRARY_PATH environment variable to the location of your libMagick++.so library.

Re: Setting up Magick++

Posted: 2007-10-30T06:41:59-07:00
by Granite
It works, thanks a lot