problem with compiling Magick++.h and wand/magick-wand.h

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
athenka

problem with compiling Magick++.h and wand/magick-wand.h

Post by athenka »

Hi guys,
I'm pretty knew to ImageMagick API, but I run into this interesting problem. In my code I want to use Blob, which is defined in Magick++.h, and modify the Blob with the wand, but I keep running into compiling issues. Here is my most simple code

Code: Select all

#include <stdio.h>
#include <Magick++.h>
#include <wand/magick-wand.h>
int main(){
  printf("hi");
  	 	MagickWand *wand;
		wand=NewMagickWand();
		
		MagickBooleanType status;
		
		Magick::Blob; 
  }
And Makefile

Code: Select all

CFLAGS= -g `Wand-config --cflags --cppflags` -shared -fPIC -fpic -O3  `Magick++-config --cppflags --cxxflags`    -I../../../include 

LIBS= -shared -fPIC -lpthread -lm -ldl `Wand-config --ldflags --libs` `Magick++-config --ldflags --libs`   -L../../lib   

PROGRAM = a.so
FILES= a.o

default: $(PROGRAM)

install: $(PROGRAM)
	cp $(PROGRAM) ../../bin

$(PROGRAM): $(FILES)
	g++ -o $(PROGRAM) $(FILES) $(LIBS)

a.o: a.cpp
	g++ $(CFLAGS) -c a.cpp

clean:
	\rm -f *~ *.o $(PROGRAM)
If I try to compile it I get this:

Code: Select all

 make
g++ -g `Wand-config --cflags --cppflags` -shared -fPIC -fpic -O3  `Magick++-config --cppflags --cxxflags`    -I../../../include  -c a.cpp
a.cpp: In function 'int main()':
a.cpp:8: error: 'MagickWand' was not declared in this scope
a.cpp:8: error: 'wand' was not declared in this scope
a.cpp:9: error: 'NewMagickWand' was not declared in this scope
a.cpp:11: error: 'MagickBooleanType' was not declared in this scope
a.cpp:11: error: expected `;' before 'status'
make: *** [a.o] Error 1
If I comment out Magick++.h, the only error I get is: a.cpp:13: error: 'Magick' has not been declared, and so I can't use Blob.

Any ideas how to sort it out? I tried switching the order of the header files, put Magick++ after wand, but then I get bunch of error from Magick++ (ie. /usr/include/Magick++/STL.h:2316: error: 'ExceptionInfo' is not a member of 'MagickLib')

Any suggestions more then welcom.

Thanks.

Alena
Post Reply