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 definecstring
before includeatlimage.h
. if project uses atl without mfc, includeatlstr.h
before includeatlimage.h
. if project uses mfc (or if atl project mfc support), includeafxstr.h
before includeatlimage.h
.likewise, must include
atlimage.h
before includeatlimpl.cpp
. accomplish easily, includeatlimage.h
instdafx.h
.
Comments
Post a Comment