이 오류 만날 때마다 잊어버려서, 아예 홈페이지에 올려 놓으려고 합니다. ^^
구체적인 오류는 다음과 같습니다.
d:\XXX.cpp(205) : error C2039: 'pOleStr' : is not a member of '_STRRET'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\shtypes.h(165) : see declaration of '_STRRET'
d:\XXX.cpp(212) : error C2039: 'uOffset' : is not a member of '_STRRET'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\shtypes.h(165) : see declaration of '_STRRET'
d:\XXX.cpp(220) : error C2039: 'cStr' : is not a member of '_STRRET'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\shtypes.h(165) : see declaration of '_STRRET'
실제로 헤더 파일에 가면 아래와 같이 정의가 되어 있습니다.
typedef struct _STRRET
{
UINT uType;
/* [switch_is][switch_type] */ union
{
/* [case()][string] */ LPWSTR pOleStr;
/* [case()] */ UINT uOffset;
/* [case()] */ char cStr[ 260 ];
} DUMMYUNIONNAME;
} STRRET;
앞/뒤로, 아무리 if defined 같은 전처리기를 찾아봐도 위의 정의를 빼먹을 만한 컴파일러 지시자는 보이지 않습니다.
결국 어렵게 찾아 헤매다 보면,
stdafx.h에 정의되어 있는 아래의 매크로 상수가 문제였음을 알게 됩니다.
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
미련 없이 주석처리하시면, 컴파일러 에러는 없어집니다. ^^