Post by a***@gmail.comfatal error C1189: #error : WINDOWS.H already included. MFC apps
must not #include <windows.h>
I am trying to create a DLL, but I need to use CString. What is a
work around this error?
Hi,
what version of the compiler are you using?
If you are using Visual C++ 7.1 or I think also VC++8, CString is now a
shared class between MFC and ATL. So you can use CString without using MFC.
You need to #include the ATL base header and CString header, if I recall
correctly that is:
#include <atlbase.h>
#include <atlstr.h>
so you can use CString.
If you are using VC6, you may copy-and-paste the CString header content and
maybe try to modify it and isolate it from MFC... or you may use C++
Standard Library std::string (for ANSI or Unicode UTF-8) or std::wstring
(for Unicode UTF-16) classes.
You may also typedef a TCHAR string e.g.:
typedef std::basic_string<TCHAR> tstring;
and use tstring instead of std::string or std::wstring.
G