mfc - C++ CImage incomplete type is not alloweed -
i incomplete type not allowed cimage image;
used this:
what went wrong? never called class before.
using namespace std; class cimage; myfunction(hbitmap bmp) { cimage image; image.attach(bmp); image.save("filename.jpg"); }
class cimage; forward declaration, tells compiler class named cimage exists, not how class defined (hence incomplete type).
you need include header file defines cimage class. try #include <atlimage.h> instead of class cimage;
from msdn cimage class ducumentation:
when create project using
cimage, must definecstringbefore includeatlimage.h. if project uses atl without mfc, includeatlstr.hbefore includeatlimage.h. if project uses mfc (or if atl project mfc support), includeafxstr.hbefore includeatlimage.h.likewise, must include
atlimage.hbefore includeatlimpl.cpp. accomplish easily, includeatlimage.hinstdafx.h.
Comments
Post a Comment