Question

I have strange error using Magick++. Error occures in the line with calling method write(). When i use this method like this:

Image image( "176x144", "white" );
image.write("1.png");

no errors, and image is written well. BUT, when i trying to make many images like this:

Image image( "176x144", "white" );
for(int i=0; i<10; i++)
image.write((char)i + ".png");

i have unhandled exception ErrorMissingDelegate. I surfed over the internet to find smth about this, but i found only that this exception is caused by missing libs for png, but in first case, png image was made, so i have no idea what it is about.

Can you help me with some ideas about that?

Was it helpful?

Solution

'(char)i + ".png"' is a memory address pointing to somewhere (not random, but not intended, too)

You might do:

std::ostringstream s;
s << i << ".png";
image.write(s.str());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top