Thursday, May 29, 2008

Porting old projects to WTL8

Hi,
after upgraded to WTL 8.0 if you try to compile old project you'll get errors like these:

error C2668: 'lstrlenA' : ambiguous call to overloaded function ...\WTL80\include\atlapp.h 697
error C2514: 'size_t' : class has no constructors ...\WTL80\include\atlapp.h 73e
error C3861: 'lstrcpynA': identifier not found ...\WTL80\include\atlapp.h 74


The way to fix it is simple, just add:
#if _ATL_VER == 0x900
#define _SECURE_ATL 1
#endif

just before the include of atlapp.h

:)