I am building a project in which 1 other project is also included. My both projects are built with "Use MFC in a Static Library" and "MT" options. My second project is a library which is compiled successfully but when i compile my main project i get following errors:
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin.h(3343): error C2872: 'CString' : ambiguous symbol
Can anybody tell me the real cause of this error
I am trying to reorder the includes and using namespaces but getting no success.
Somewhere in library code i have defined CString (typedef CObjectSimple<pstring> CString in header file A which is included in header file B. I have included header file B in my app
#pragma once
#include "stdafx.h"
#include "PDFTools.h"
#include <sstream>
#include <myheaderfiles>
#include <myheaderfiles>
#include <myheaderfiles>
#include <myheaderfiles>
#include <myheaderfiles>
#include <myheaderfiles>
#include <myheaderfiles>
#include <boost/program_options.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <limits>
#include <myheaderfiles>
#include <myheaderfiles>
#ifdef WIN32
#include <Windows.h>
#undef max
#undef min
#endif
using namespace std;
using namespace boost;
using namespace ...; This is namespace which is getting error
using namespace ...;
namespace ...;
I commented the win32 include but got no success.
Error is given by system file as u can see
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin.h(3331): error C2872: 'CString' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxstr.h(99) : ATL::CStringT<BaseType,StringTraits> CString'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC_DLL<wchar_t>
]
or .....myheaderFilelocation(295) : myclassobject::CString'
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin.h(3361) : see reference to function template instantiation 'TReturnType CWnd::EnlargeBufferGetText<TReturnType,int>(TRetur nType,LPTSTR &,TCchType &,TCchType,TCchType,UINT,WPARAM &,LPARAM &,CString &) throw(...) const' being compiled
with
[
TReturnType=BOOL,
TCchType=int
]
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin4.inl(132) : see reference to function template instantiation 'TReturnType CWnd::EnlargeBufferGetText<BOOL>(TReturnType,LPTST R &,int &,UINT,WPARAM &,LPARAM &,CString &) throw(...) const' being compiled
with
[
TReturnType=BOOL
]
one thing which i forget to tell is that this code is working fine in Debug mode. Release mode is giving problem