neoanderz
asked on
How do you use ImageMagick?
I have Windows XP and Visual C++ 6.0. I downloaded ImageMagick, built the config program, ran it, and then built "VisualDynamicMT". From the ImageMagick website, this sample program is given for resizing an image:
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
// Construct the image object. Seperating image construction from the
// the read operation ensures that a failure to read the image file
// doesn't render the image object useless.
Image image;
try {
// Read a file into image object
image.read( "girl.gif" );
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Geometry(100,100, 100, 100) );
// Write the image to a file
image.write( "x.gif" );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
I compiled this with no errors (1 warning) but when I build it I get this:
--------------------Config uration: mytest - Win32 Debug--------------------
Linking...
mytest.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Magick::Image::~Image(void )" (??1Image@Magick@@UAE@XZ)
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::write(class std::basic_string<char,str uct std::char_traits<char>,cla ss std::allocator<char> > const &)" (?write@Image@Magick@@QAEX ABV?$basic _string@DU ?$ch
ar_traits@D@std@@V?$alloca tor@D@2@@s td@@@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Geometry::~Geometr y(void)" (??1Geometry@Magick@@QAE@X Z)
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::crop(class Magick::Geometry const &)" (?crop@Image@Magick@@QAEXA BVGeometry @2@@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Geometry::Geometry (unsigned int,unsigned int,unsigned int,unsigned int,bool,bool)" (??0Geometry@Magick@@QAE@I III_N0@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::read(class std::basic_string<char,str uct std::char_traits<char>,cla ss std::allocator<char> > const &)" (?read@Image@Magick@@QAEXA BV?$basic_ string@DU? $char
_traits@D@std@@V?$allocato r@D@2@@std @@@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Image::Image(void) " (??0Image@Magick@@QAE@XZ)
Debug/mytest.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
mytest.exe - 8 error(s), 0 warning(s)
I have no idea what any of this means. What do I need to do in order to use ImageMagick?
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
// Construct the image object. Seperating image construction from the
// the read operation ensures that a failure to read the image file
// doesn't render the image object useless.
Image image;
try {
// Read a file into image object
image.read( "girl.gif" );
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Geometry(100,100, 100, 100) );
// Write the image to a file
image.write( "x.gif" );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
I compiled this with no errors (1 warning) but when I build it I get this:
--------------------Config
Linking...
mytest.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Magick::Image::~Image(void
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::write(class
ar_traits@D@std@@V?$alloca
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Geometry::~Geometr
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::crop(class Magick::Geometry const &)" (?crop@Image@Magick@@QAEXA
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Geometry::Geometry
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::read(class std::basic_string<char,str
_traits@D@std@@V?$allocato
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Image::Image(void)
Debug/mytest.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
mytest.exe - 8 error(s), 0 warning(s)
I have no idea what any of this means. What do I need to do in order to use ImageMagick?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.