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 define cstring before include atlimage.h. if project uses atl without mfc, include atlstr.h before include atlimage.h. if project uses mfc (or if atl project mfc support), include afxstr.h before include atlimage.h.

likewise, must include atlimage.h before include atlimpl.cpp. accomplish easily, include atlimage.h in stdafx.h.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -