Need compile help with Magick++ (No such file or directory)

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
rtconner

Need compile help with Magick++ (No such file or directory)

Post by rtconner »

I think I have it installed correct

Code: Select all

> Magick++-config --cxxflags --cppflags --ldflags --libs
-g -O2 -Wall -W -pthread
-I/usr/local/include/ImageMagick
-L/usr/local/lib
-L/usr/local/lib -lMagick++ -lMagickWand -lMagickCore -lm -lgomp -lpthread
I made example.cpp

Code: Select all

#include <Magick++.h>

using namespace Magick;

int main(int argc, char* argv[]) {
        return 0;
}
But can't compile??

Code: Select all

> c++ `Magick++-config --cxxflags --cppflags --ldflags --libs` -o example example.cpp
example.cpp:1:22: error: Magick++.h: No such file or directory
example.cpp:3: error: âMagickâ is not a namespace-name
example.cpp:3: error: expected namespace-name before â;â token
example.cpp:5: warning: unused parameter âargcâ
example.cpp:5: warning: unused parameter âargvâ
I'm on Ubuntu. And also I'm out of ideas.
rtconner

Re: Need compile help with Magick++ (No such file or directo

Post by rtconner »

Figured out the problem. The Magick++-config was spitting out the wrong path for some reason. I just built a symlink that pointed to the right path to fix this.
PeterisI

Re: Need compile help with Magick++ (No such file or directo

Post by PeterisI »

How did you build the symlink?
when i try to compile the makefile i created for compiling the cpp file i get a bunch of errors that there is no Magick++.h file or directory

Code: Select all

g++ -o prg231 231.cpp 'Magick++-config --cppflags --cxxflags --ldflags --libs'
g++: Magick++-config --cppflags --cxxflags --ldflags --libs: No such file or directory
231.cpp:1:22: error: Magick++.h: No such file or directory
231.cpp:2: error: ‘Magick’ is not a namespace-name
231.cpp:2: error: expected namespace-name before ‘;’ token
231.cpp: In function ‘int main()’:
231.cpp:6: error: ‘Image’ was not declared in this scope
231.cpp:10: error: ‘Geometry’ was not declared in this scope
make: *** [231] Error 1
i'm using Mint
HardArt

Re: Need compile help with Magick++ (No such file or directo

Post by HardArt »

I'm using ubuntu for the first time - just to run imagemagick, but i'm really struggling to load IM.
I have tried running the following commands
identify -version
Version: ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
cd ImageMagick-6.5.1
bash: cd: ImageMagick-6.5.1: No such file or directory
./configure
bash: ./configure: No such file or directory
make
make: *** No targets specified and no makefile found. Stop.
sudo make install
[sudo] password for hagraphics:
make: *** No rule to make target `install'. Stop.
/usr/local/bin/convert logo: logo.gif
bash: /usr/local/bin/convert: No such file or directory

So as you can see i'm a longway off from getting to use IM in linux
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need compile help with Magick++ (No such file or directo

Post by fmw42 »

search your directory for the full path the decompressed IM folder (did you decompress it?) and cd to that using the full path. Usually the folder will be something like ImageMagick-6.6.1-0 (with the -x). The from there: ./configure, make, sudo make install
HardArt

Re: Need compile help with Magick++ (No such file or directo

Post by HardArt »

Thanks fmw42, thats moved me a long a bit further.
I downloaded ImageMagick.tar.gz ran tar xvfz ImageMagick.tar.gz renamed directory to shorten it and moved it from downloads to /home/hagraphics/ImageMagick-6.6.1
Then ./configure, make, and tried sudo make install but came up with following

hagraphics@ubuntu:~/ImageMagick-6.6.1$ sudo make install
make install-am
make[1]: Entering directory `/home/hagraphics/ImageMagick-6.6.1'
make[2]: Entering directory `/home/hagraphics/ImageMagick-6.6.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/bash ./libtool --mode=install /usr/bin/install -c magick/libMagickCore.la wand/libMagickWand.la '/usr/local/lib'
libtool: install: /usr/bin/install -c magick/.libs/libMagickCore.so.3.0.0 /usr/local/lib/libMagickCore.so.3.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libMagickCore.so.3.0.0 libMagickCore.so.3 || { rm -f libMagickCore.so.3 && ln -s libMagickCore.so.3.0.0 libMagickCore.so.3; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libMagickCore.so.3.0.0 libMagickCore.so || { rm -f libMagickCore.so && ln -s libMagickCore.so.3.0.0 libMagickCore.so; }; })
libtool: install: /usr/bin/install -c magick/.libs/libMagickCore.lai /usr/local/lib/libMagickCore.la
libtool: install: warning: relinking `wand/libMagickWand.la'
libtool: install: (cd /home/hagraphics/ImageMagick-6.6.1; /bin/bash /home/hagraphics/ImageMagick-6.6.1/libtool --silent --tag CC --mode=relink gcc -std=gnu99 -std=gnu99 -fopenmp -g -O2 -Wall -W -pthread -no-undefined -export-symbols-regex ".*" -version-info 3:0:0 -o wand/libMagickWand.la -rpath /usr/local/lib wand/wand_libMagickWand_la-animate.lo wand/wand_libMagickWand_la-compare.lo wand/wand_libMagickWand_la-composite.lo wand/wand_libMagickWand_la-conjure.lo wand/wand_libMagickWand_la-convert.lo wand/wand_libMagickWand_la-deprecate.lo wand/wand_libMagickWand_la-display.lo wand/wand_libMagickWand_la-drawing-wand.lo wand/wand_libMagickWand_la-identify.lo wand/wand_libMagickWand_la-import.lo wand/wand_libMagickWand_la-magick-image.lo wand/wand_libMagickWand_la-magick-property.lo wand/wand_libMagickWand_la-magick-wand.lo wand/wand_libMagickWand_la-mogrify.lo wand/wand_libMagickWand_la-montage.lo wand/wand_libMagickWand_la-pixel-iterator.lo wand/wand_libMagickWand_la-pixel-view.lo wand/wand_libMagickWand_la-pixel-wand.lo wand/wand_libMagickWand_la-stream.lo wand/wand_libMagickWand_la-wand.lo magick/libMagickCore.la -lgomp -lm )
libtool: install: /usr/bin/install -c wand/.libs/libMagickWand.so.3.0.0T /usr/local/lib/libMagickWand.so.3.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libMagickWand.so.3.0.0 libMagickWand.so.3 || { rm -f libMagickWand.so.3 && ln -s libMagickWand.so.3.0.0 libMagickWand.so.3; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libMagickWand.so.3.0.0 libMagickWand.so || { rm -f libMagickWand.so && ln -s libMagickWand.so.3.0.0 libMagickWand.so; }; })
libtool: install: /usr/bin/install -c wand/.libs/libMagickWand.lai /usr/local/lib/libMagickWand.la
libtool: install: /usr/bin/install -c magick/.libs/libMagickCore.a /usr/local/lib/libMagickCore.a
libtool: install: chmod 644 /usr/local/lib/libMagickCore.a
libtool: install: ranlib /usr/local/lib/libMagickCore.a
libtool: install: /usr/bin/install -c wand/.libs/libMagickWand.a /usr/local/lib/libMagickWand.a
libtool: install: chmod 644 /usr/local/lib/libMagickWand.a
libtool: install: ranlib /usr/local/lib/libMagickWand.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/bin/bash ./libtool --mode=install /usr/bin/install -c utilities/animate utilities/compare utilities/composite utilities/conjure utilities/convert utilities/display utilities/identify utilities/import utilities/mogrify utilities/montage utilities/stream '/usr/local/bin'
libtool: install: /usr/bin/install -c utilities/.libs/animate /usr/local/bin/animate
libtool: install: /usr/bin/install -c utilities/.libs/compare /usr/local/bin/compare
libtool: install: /usr/bin/install -c utilities/.libs/composite /usr/local/bin/composite
libtool: install: /usr/bin/install -c utilities/.libs/conjure /usr/local/bin/conjure
libtool: install: /usr/bin/install -c utilities/.libs/convert /usr/local/bin/convert
libtool: install: /usr/bin/install -c utilities/.libs/display /usr/local/bin/display
libtool: install: /usr/bin/install -c utilities/.libs/identify /usr/local/bin/identify
libtool: install: /usr/bin/install -c utilities/.libs/import /usr/local/bin/import
libtool: install: /usr/bin/install -c utilities/.libs/mogrify /usr/local/bin/mogrify
libtool: install: /usr/bin/install -c utilities/.libs/montage /usr/local/bin/montage
libtool: install: /usr/bin/install -c utilities/.libs/stream /usr/local/bin/stream
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c magick/Magick-config magick/MagickCore-config wand/Wand-config wand/MagickWand-config '/usr/local/bin'
( cd PerlMagick && make CC='gcc -std=gnu99 -std=gnu99' && \
make CC='gcc -std=gnu99 -std=gnu99' install && \
make clean && rm -f Makefile.old )
make[3]: Entering directory `/home/hagraphics/ImageMagick-6.6.1/PerlMagick'
rm -f blib/arch/auto/Image/Magick/Magick.so
LD_RUN_PATH="/home/hagraphics/ImageMagick-6.6.1/PerlMagick/../magick/.libs" cc -L../magick/.libs -lMagickCore -shared -O2 -g -L/usr/local/lib Magick.o -o blib/arch/auto/Image/Magick/Magick.so \
-L/home/hagraphics/ImageMagick-6.6.1/PerlMagick/../magick/.libs -lMagickCore -lperl -lm \

/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status
make[3]: *** [blib/arch/auto/Image/Magick/Magick.so] Error 1
make[3]: Leaving directory `/home/hagraphics/ImageMagick-6.6.1/PerlMagick'
make[2]: *** [install-exec-perl] Error 2
make[2]: Leaving directory `/home/hagraphics/ImageMagick-6.6.1'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/hagraphics/ImageMagick-6.6.1'
make: *** [install] Error 2


any suggestions?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need compile help with Magick++ (No such file or directo

Post by fmw42 »

I don't really know. But did you cd to the directory before issuing ./configure, make and sudo make install? You have to do those from the top level of the IM source code directory that you got after decompressing and renaming. E.G.

cd /home/hagraphics/ImageMagick-6.6.1
./configure
make
sudo make install
HardArt

Re: Need compile help with Magick++ (No such file or directo

Post by HardArt »

Just ran thru it all, made sure i was in correct directory as suggested - same result.

Can I just delete the directories and start a fresh?

Or should I reload ubuntu and start a fresh

or should i use fedora or some other setup


Thx for your input
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need compile help with Magick++ (No such file or directo

Post by fmw42 »

I am not a unix guru. But I would try simply one of the following:

make distclean

or

make uninstall

from the IM source directory.

see http://www.imagemagick.org/script/advan ... .php#build

Then try re-installing delegates and IM.
HardArt

Re: Need compile help with Magick++ (No such file or directo

Post by HardArt »

I'll go for that in the morning as its coming u pto 2am - whats a delegate?

Thanks again for your help
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need compile help with Magick++ (No such file or directo

Post by fmw42 »

If you build from source, there are support libraries for different types of images and other things that are not installed by IM. They need to be installed prior to installing from IM source. These include such delegate libraries as libtiff, libpng, and libjpg (for tiff, png and jpg) images.

Old versions can be found at http://www.imagemagick.org/download/delegates/ but you may want to do an internet search for more current versions.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Need compile help with Magick++ (No such file or directo

Post by el_supremo »

@ PeterisI
I think you have the wrong type of quotes in that command. You need to use the backquotes like this:

Code: Select all

g++ -o prg231 231.cpp `Magick++-config --cppflags --cxxflags --ldflags --libs`
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
HardArt

Re: Need compile help with Magick++ (No such file or directo

Post by HardArt »

In reply to,

@ PeterisI
I think you have the wrong type of quotes in that command. You need to use the backquotes like this:

Code: Select all
g++ -o prg231 231.cpp `Magick++-config --cppflags --cxxflags --ldflags --libs`

hagraphics@ubuntu:~/ImageMagick-6.6.1$ g++ -o prg231 231.cpp `Magick++-config --cppflags --cxxflags --ldflags --libs`
The program 'Magick++-config' can be found in the following packages:
* libmagick++-dev
Try: sudo apt-get install <selected package>
Magick++-config: command not found
The program 'g++' can be found in the following packages:
* g++
* pentium-builder
Try: sudo apt-get install <selected package>
g++: command not found
Post Reply