Page 1 of 1

Compiling in Ubuntu 12.04.1

Posted: 2013-03-07T01:21:17-07:00
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!

Re: Compiling in Ubuntu 12.04.1

Posted: 2013-03-07T04:19:59-07:00
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

Re: Compiling in Ubuntu 12.04.1

Posted: 2014-04-05T14:55:54-07:00
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.