Article ID: 140751 - View products that this article applies to.
This article was previously published under Q140751
This article has been archived. It is offered "as is" and will no longer be updated.
The _AFX_NO_XXX macros are not intended to be defined or undefined by users of MFC. These macros exist only for the purpose of checking whether a particular target platform supports that feature or not. You can write your program to check these macros (for example, #ifndef _AFX_NO_OLE_SUPPORT), but your program should never define or undefine these macros.
If you define _AFX_NO_OLE_SUPPORT, the symptoms might include:
If you define or undefine any of these macros differently from the way MFC defines them, then your application's compile will be based on a different definition of MFC than the pre-compiled MFC library.
One example of how these macros are used by MFC can be found in AfxWin.h. CCmdTarget has the following section of code in its declaration:
If _AFX_NO_OLE_SUPPORT is defined in your project, then the declaration of CCmdTarget will not include this virtual function. However, the compiled version of CCmdTarget in the MFC library does contain this function. This will result in a v-table mismatch between your code and MFC's code.
Don't define or undefine these macros in your own code. They are intended to be tested only. For example, for maximum future portability, if MFC were to eventually target a platform that did not contain OLE support, then you could use _AFX_NO_OLE_SUPPORT as follows:
A common place to try to use these macros might be in your pre-compiled header file (for example, StdAfx.h). In this case, you don't need to define these symbols to prevent the including of unneccessary header files, you can simply remove the #include lines.
Article ID: 140751 - Last Review: September 27, 2013 - Revision: 2.1
Contact us for more help
Connect with Answer Desk for expert help.