I install ImageMagick-6.7.8-10-Q16-windows-dll and use VS2008 to build my project.( I have also used VS2010 but it still not work. )
But when I want to read image, however , I meet a problem
This is my code and it looks very easy but it can't execute...
The error is occurred at image.read( "flower.jpg" ); this line.
First-chance exception at 0x71e21f77 (msvcr100.dll) in TestIM.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x71e21f77 (msvcr100.dll) in TestIM.exe: 0xC0000005: Access violation reading location 0x00000000.
Can somebody help me? THX
Code: Select all
#include "stdafx.h"
#include <Magick++.h>
#include <Magick++/Image.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
InitializeMagick(*argv);
InitializeMagick("C:\Program Files\ImageMagick-6.7.8-Q16");
InitializeMagick("C:\Users\e7215798\Documents\Visual Studio 2008\Projects\TestIM\TestIM");
Image image;
try {
image.read( "flower.jpg" );
image.crop( Geometry(100,100, 100, 100) );
image.write( "x.gif" );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}