Magick++ with Makefile - no idea what I'm doing.
Posted: 2008-07-11T04:12:17-07:00
I've got some code I'm writing in OpenSUSE, and I've a need for Magick++.
I installed Magick++ via the YaST software installer, and everything looked good - I have libMagick.a and various .so files etc. tucked away in usr/lib64
So, I added a coulpe of lines of code to test the Magick++, and am confronted with errors like this:
Lots and lots of these. So, makes me think I must be not linking to a needed Magick++ library or the like. To a large extent, I don't really know what I'm doing when it comes to linking to libraries using a Makefile. This is the first one I've done. We all start somewhere, I suppose. The line in my makefile where I try to link to the library is as follows:
Can anyone explain what's going wrong to produce these error messages, and whether I'm doing the right sort of thing in the Makefile?
Edit: Eventually changed the Makefile line to read as follows:
All seemed good for a while, until the following lines of code
gave the error
No error about creating an object of type Image, so it seems that something is going right, but then this error when I try to use the read function of that type (or any other function of that type).
I installed Magick++ via the YaST software installer, and everything looked good - I have libMagick.a and various .so files etc. tucked away in usr/lib64
So, I added a coulpe of lines of code to test the Magick++, and am confronted with errors like this:
Code: Select all
(.text+0x79f): undefined reference to `AcquireImagePixels'
/usr/lib64/libMagick++.a(Image.o): In function `Magick::Image::getConstPixels(int, int, unsigned int, unsigned int) const':
(.text+0x7b2): undefined reference to `DestroyExceptionInfo'
/usr/lib64/libMagick++.a(Image.o): In function `Magick::Image::type() const':
Code: Select all
rec: hardware/rec.c audio_utils.o utils.o
g++ $(FLAGS) -I. $(HARDWARE_INCLUDE) hardware/rec.c /usr/lib64/libMagick++.a audio_utils.o utils.o $(HARDWARE_LIB) -lpthread -o rec
Edit: Eventually changed the Makefile line to read as follows:
Code: Select all
rec: hardware/rec.c audio_utils.o utils.o
g++ $(FLAGS) -I. $(HARDWARE_INCLUDE) `Magick++-config --cxxflags --cppflags --ldflags --libs` hardware/rec.c /usr/lib64/libMagick++.a audio_utils.o utils.o $(HARDWARE_LIB) -lpthread -o record
Code: Select all
Image Mimage();
Mimage.read("testout.png");
Code: Select all
hardware/rec.c:122: error: expected constructor, destructor, or type conversion before ‘.’ token