EDN Admin
Well-known member
I have looked through the other posts concerning this error and I am sure that this situation is different.
I have a C++ COM ATL project and am trying to use CStringList which resides in <afxcoll.h>
But when I include <afxcoll.h>
#include<font size="1 "stdafx.h"
</font><font color="#0000ff" size="1 #include</font><font size="1 <afxcoll.h>
</font>
I get the error:
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Id be very grateful for any help. By the way the stdafx.h file looks like this:
<font color="#0000ff" size="1
#pragma</font><font size="1 </font><font color="#0000ff" size="1 once
#ifndef</font><font size="1 STRICT
</font><font color="#0000ff" size="1 #define</font><font size="1 STRICT
</font><font color="#0000ff" size="1 #endif </font><font color="#008000" size="1 // Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms. </font><font color="#0000ff" size="1 #ifndef</font><font size="1 WINVER </font><font color="#008000" size="1 // Allow use of features specific to Windows 95 and Windows NT 4 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 WINVER 0x0400 </font><font color="#008000" size="1 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
</font><font color="#0000ff" size="1 #endif #ifndef</font><font size="1 _WIN32_WINNT </font><font color="#008000" size="1 // Allow use of features specific to Windows NT 4 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 _WIN32_WINNT 0x0400 </font><font color="#008000" size="1 // Change this to the appropriate value to target Windows 2000 or later.
</font><font color="#0000ff" size="1 #endif</font><font size="1 </font><font color="#0000ff" size="1 #ifndef</font><font size="1 _WIN32_WINDOWS </font><font color="#008000" size="1 // Allow use of features specific to Windows 98 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 _WIN32_WINDOWS 0x0410 </font><font color="#008000" size="1 // Change this to the appropriate value to target Windows Me or later.
</font><font color="#0000ff" size="1 #endif #ifndef</font><font size="1 _WIN32_IE </font><font color="#008000" size="1 // Allow use of features specific to IE 4.0 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 _WIN32_IE 0x0400 </font><font color="#008000" size="1 // Change this to the appropriate value to target IE 5.0 or later.
</font><font color="#0000ff" size="1 #endif #define</font><font size="1 _ATL_APARTMENT_THREADED
</font><font color="#0000ff" size="1 #define</font><font size="1 _ATL_NO_AUTOMATIC_NAMESPACE
</font><font color="#0000ff" size="1 #define</font><font size="1 _ATL_CSTRING_EXPLICIT_CONSTRUCTORS </font><font color="#008000" size="1 // some CString constructors will be explicit // turns off ATLs hiding of some common and often safely ignored warning messages </font><font color="#0000ff" size="1 #define</font><font size="1 _ATL_ALL_WARNINGS
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlbase.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlcom.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlwin.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atltypes.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlctl.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlhost.h> </font><font color="#0000ff" size="1 using</font><font size="1 </font><font color="#0000ff" size="1 namespace</font><font size="1 ATL; </font>
<font size="1
</font>
View the full article
I have a C++ COM ATL project and am trying to use CStringList which resides in <afxcoll.h>
But when I include <afxcoll.h>
#include<font size="1 "stdafx.h"
</font><font color="#0000ff" size="1 #include</font><font size="1 <afxcoll.h>
</font>
I get the error:
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Id be very grateful for any help. By the way the stdafx.h file looks like this:
<font color="#0000ff" size="1
#pragma</font><font size="1 </font><font color="#0000ff" size="1 once
#ifndef</font><font size="1 STRICT
</font><font color="#0000ff" size="1 #define</font><font size="1 STRICT
</font><font color="#0000ff" size="1 #endif </font><font color="#008000" size="1 // Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms. </font><font color="#0000ff" size="1 #ifndef</font><font size="1 WINVER </font><font color="#008000" size="1 // Allow use of features specific to Windows 95 and Windows NT 4 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 WINVER 0x0400 </font><font color="#008000" size="1 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
</font><font color="#0000ff" size="1 #endif #ifndef</font><font size="1 _WIN32_WINNT </font><font color="#008000" size="1 // Allow use of features specific to Windows NT 4 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 _WIN32_WINNT 0x0400 </font><font color="#008000" size="1 // Change this to the appropriate value to target Windows 2000 or later.
</font><font color="#0000ff" size="1 #endif</font><font size="1 </font><font color="#0000ff" size="1 #ifndef</font><font size="1 _WIN32_WINDOWS </font><font color="#008000" size="1 // Allow use of features specific to Windows 98 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 _WIN32_WINDOWS 0x0410 </font><font color="#008000" size="1 // Change this to the appropriate value to target Windows Me or later.
</font><font color="#0000ff" size="1 #endif #ifndef</font><font size="1 _WIN32_IE </font><font color="#008000" size="1 // Allow use of features specific to IE 4.0 or later.
</font><font color="#0000ff" size="1 #define</font><font size="1 _WIN32_IE 0x0400 </font><font color="#008000" size="1 // Change this to the appropriate value to target IE 5.0 or later.
</font><font color="#0000ff" size="1 #endif #define</font><font size="1 _ATL_APARTMENT_THREADED
</font><font color="#0000ff" size="1 #define</font><font size="1 _ATL_NO_AUTOMATIC_NAMESPACE
</font><font color="#0000ff" size="1 #define</font><font size="1 _ATL_CSTRING_EXPLICIT_CONSTRUCTORS </font><font color="#008000" size="1 // some CString constructors will be explicit // turns off ATLs hiding of some common and often safely ignored warning messages </font><font color="#0000ff" size="1 #define</font><font size="1 _ATL_ALL_WARNINGS
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlbase.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlcom.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlwin.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atltypes.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlctl.h>
</font><font color="#0000ff" size="1 #include</font><font size="1 <atlhost.h> </font><font color="#0000ff" size="1 using</font><font size="1 </font><font color="#0000ff" size="1 namespace</font><font size="1 ATL; </font>
<font size="1
</font>
View the full article