Compiling in Ubuntu 12.04.1

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
ddluc32
Posts: 1
Joined: 2013-03-07T01:01:28-07:00
Authentication code: 6789

Compiling in Ubuntu 12.04.1

Post by ddluc32 »

First, I apologize for my inexperience in developing in both c++ and on the Linux operating system.

I wanted to use Magick++ to develop my final project for my CmpSci class. However, we are not provided any help beyond what is covered directly in the course. Right now I am still working on compiling my first program.

I have Magick++ installed as far as I can tell. So I created a .cpp file and have been stuck on compiling it. I'm trying to follow the tutorial to the best of my knowledge, but it assumes that you are relatively familiar with executing terminal commands, which I am not.

I know I can compile a basic program with:

Code: Select all

g++ main.cpp -o Demo.exe 


So I tried including the Magick++ library as follows:

Code: Select all

g++ main.cpp -o Demo.exe `Magick++-config --cppflags --cxxflags --ldflags --libs`
However when I run this code, I get:

Code: Select all

/usr/bin/ld: cannot find -lMagick++6-Q16
/usr/bin/ld: cannot find -lMagick++6-Q16
/usr/bin/ld: cannot find -lMagick++6-Q16
collect2: ld returned 1 exit status
Any help to get me on the right track would be greatly appreciated.

Thanks!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Compiling in Ubuntu 12.04.1

Post by magick »

Here is the canonical form of building a Magick++ source module from the command line:
  • g++ `Magick++-config --cxxflags --cppflags` -O2 -Wall -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
If that fails, try the Magick++-config command by itself to determine where its looking for the MagickCore and Magick++ libaries:
  • Magick++-config --cxxflags --cppflags
    Magick++-config --ldflags --lib
seaperl
Posts: 1
Joined: 2014-04-05T14:38:31-07:00
Authentication code: 6789

Re: Compiling in Ubuntu 12.04.1

Post by seaperl »

I'm having a similiar problem installing imagemagick. Ran:
./configure --with-perl
But got error when I run "make install":
/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status

Tried: ./configure --with-libstdc=-L/usr/lib/perl5 --with-perl
But doesn't seem to have an impact and it's really urgent I get it done and would really appreciate any help.
I believe it needs a library for perl and this is the best answer I have and don't know much more than this.
Post Reply