Windows. H already included. MFC apps must not #include

Source: Internet
Author: User

One, error C1189: #error: WINDOWS.  H already included. MFC apps must not #include <windows.h>


This error is often reported when we introduce MFC into the Win32 application that we built in vs2013. This is because WINDOWS.H has been introduced into MFC's class library files,

In VS, each. App file introduces the stdafx.h header file by default, and the following code is the entire contents of stdafx.h, which is also introduced into the WINDOWS.H

#include "Targetver.h"
#define Win32_lean_and_mean
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

The workaround is to delete the #include<windows.h> in the stdafx.h header file.


Two, error LNK2005: "Void __cdecl operator delete (void *)" (?? 3@YAXPAX@Z) has been defined in LIBCMTD.lib (dbgdel.obj)


In MFC's class library, the void __cdecl operator delete (void *) method is defined more than once, nafxcw.lib and LIBCMT.lib are defined, and when we introduce an MFC class library

The two files will be introduced by default, and many times we will need these two files.

The solution is to click on my Items >> right button to select Properties >> Configuration Properties >> General >> Scroll down >> find MFC using the >> set to use MFC in shared DLLs.

       




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.