Setting up Magick++

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Granite

Setting up Magick++

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

Re: Setting up Magick++

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

Re: Setting up Magick++

Post by Granite »

It works, thanks a lot
Post Reply