Click to See Complete Forum and Search --> : error C2872 'CStringData' ambiguous symbol


Sarvotham
December 7th, 2005, 08:16 AM
I have a ATL COM component (housed in a DLL) that is developed using .net. I am trying to import a MFC class derived from CObject into this dll. This MFC class has a member of type CStringData structure. Since this structure is defined in afx.h of MFC, afx.h of .net I am seeing following compiler errors.

D:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\AFX.H(609) : error C2872: 'CStringData' : ambiguous symbol
could be 'D:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\AFX.H(357) : CStringData'
or 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsimpstr.h(57) : ATL::CStringData'
D:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\AFX.H(619) : error C2872: 'CStringData' : ambiguous symbol

How to avoid this error? I want it to pick CStringData definition from MFC\include\afx.h and not from the afx.h of .net

cilu
December 7th, 2005, 09:07 AM
In VS2003 go to Tools, Options, Directories, Include Files and remove the VS6.0 files. That hsould fix it. You don't need those in VC++7.1.