Question

I am using an example from MSDN, but I get "'CImage' : undeclared identifier"?

CImage myimage;
   // load existing image
   myimage.Load("image.bmp"); 
      // save an image in BMP format
   myimage.Save("c:\image1.bmp");
   // save an image in BMP format
   myimage.Save("c:\image2",ImageFormatBMP);
   // save an image in JPEG format
   myimage.Save("c:\image3.jpg");
   // save an image in BMP format, even though jpg file extension is used
   myimage.Save("c:\image4.jpg",ImageFormatBMP);
Was it helpful?

Solution

The documentation for CImage shows that it is defined in atlimage.h. You must #include that in your source. Also note the warning that you must include afxstr.h first to avoid errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top