cannot compile

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
tominko
Posts: 6
Joined: 2011-05-26T14:42:02-07:00
Authentication code: 8675308

cannot compile

Post by tominko »

i'm trying to add magick++ to my c++ project, i've install it following the steps on (http://www.imagemagick.org/script/binary-releases.php) - i have mac - there is one small bug - after decompress it is in "ImageMagick-6.6.9" folder instead of "ImageMagick-6.7.0" which is in instructions - but thats not the problem.

my code:

Code: Select all

#include <Magick++.h>
...
Magick::Image iMg();
iMg.read("aa.gif");
my Makefile:

Code: Select all

CC=g++
CFLAGS=-c -Wall ... -m32 -Wall -ansi -pedantic -O3 -Wno-long-long -I /Users/tominko/ImageMagick-6.6.9/include/ImageMagick 
LDFLAGS=... -m32 -pthread -L /Users/tominko/ImageMagick-6.6.9/lib -lMagick++ -ljpeg -lpng -ltiff -lbz2 -lxml2 -lz -lm -lgomp -lclparser -lMagickWand -lMagickCore
...
when i compile my project i've got error:
error: request for member ‘read’ in ‘iMg’, which is of non-class type ‘Magick::Image ()()’
i've tried as well the "Magick++-config ....." option with error:
error: Magick++.h: No such file or directory
if i run "Magick++-config --cppflags --cxxflags --ldflags --libs" there is lots of non-existing directories as well for example "$MAGICK_HOME-10" i have set my $MAGICK_HOME to "/Users/tominko/ImageMagick-6.6.9"

commandline function 'convert' working ok

please help ;-(
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: cannot compile

Post by magick »

Let's start with a Magick++ script that we know works:

Code: Select all

#include "Magick++.h"

using namespace std;
using namespace Magick;
void testbild()
{
  Image  image;
  image.read( "logo:");
  Geometry newSize = Geometry(720, 480);
  image.scale(newSize);
  image.write( "logo.png");
}

int main(int argc, char **argv)
{
   InitializeMagick(*argv);
   testbild(); // OK
   return 0;
}
tominko
Posts: 6
Joined: 2011-05-26T14:42:02-07:00
Authentication code: 8675308

Re: cannot compile

Post by tominko »

i dont think the problem will be sorted by adding

using namespace std;
using namespace Magick;

...i've tried that as well with the same error

because im specified namespace in initialization Magick::Image iMg();


i think the problem is that the binary distribution is 64bit and i'm using -m32 for compiling my project in 32bit (which i need because i cant get mysql++ proper working on 64bit)

i've tried to install ImageMagick from source in 32bit but without luck, is there any 32bit binary distribution for osx?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: cannot compile

Post by magick »

Have you look at the options available @ http://www.macports.org/ports.php?by=na ... mageMagick?
tominko
Posts: 6
Joined: 2011-05-26T14:42:02-07:00
Authentication code: 8675308

Re: cannot compile

Post by tominko »

yes, there is no option to force install 32bit version - it will be 32bit only if its compiled on 32bit system ;-(
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: cannot compile

Post by magick »

Isn't the +Universal option 32-bit?
tominko
Posts: 6
Joined: 2011-05-26T14:42:02-07:00
Authentication code: 8675308

Re: cannot compile

Post by tominko »

Universal means it's compiled for PowerPC processor as well as for intel (older macs have powerpc processors)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: cannot compile

Post by magick »

Right. We were thinking it might be 32-bit as well. Perhaps not.
tominko
Posts: 6
Joined: 2011-05-26T14:42:02-07:00
Authentication code: 8675308

Re: cannot compile

Post by tominko »

I've managed to get running mysql in 64bit, but now it looks like there is some problem with threads and magick ;-(

if i run your testing script in the main procedure it will run fine, but if i put it where i need it - in procedure which is created as a separate thread then i've got segmentation fault ;-(

any ideas?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: cannot compile

Post by magick »

You need a version of ImageMagick that does not include OpenMP support. Under Linux OpenMP and Posix threads are compatible. Not so for Mac OS X.
tominko
Posts: 6
Joined: 2011-05-26T14:42:02-07:00
Authentication code: 8675308

Re: cannot compile

Post by tominko »

imagemagick recompiled without threads and without openmp and its working fine now ;-) ...just it takes over hour and half to install all required packages ;-)

Thanx for help
Post Reply