CDC::DrawText unrecognized

Using the Wizzard to create a MFC OCC app and inserting the line pDC->DrawText(); in the view's draw function (not that I really want it there, but it shows the problem) and the error "C2039: 'DrawText' : is not a member of 'CDC'" is generated.

Stephane Routelous's picture

It is because, somewhere in the OpenCASCADE includes, you have a :
#ifdef DrawText
#undef DrawText
#endif
( I don't remember where )

As workaround, you can use
::DrawTextA or ::DrawTextW if you are in UNICODE or not.

Or, at the beginning of your CView :
#ifdef UNICODE
#define DrawText DrawTextW
#else
#define DrawText DrawTextA
#endif // !UNICODE

HTH

fryguybob's picture

Thanks, the workaround did the trick, but I still can't use CDC::DrawText.

Ryan

Stephane Routelous's picture

BTW, register a bug !!