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;
}
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)
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
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