Error 1 error c1189: # error: "include 'stdafx. H' before including this file Error

Source: Internet
Author: User

Solution to error 1 error c1189: # error: "include 'stdafx. H' before including this file

If this error occurs in. DLL, but compile. DLL no problem, when. this error occurs when the DLL is included in project B to which it is to be used and the project containing it is compiled.

If you have added the following content to the stdafx. h file in Project BCode: You can.

# Pragma once
# DEFINE _ afxdll
# Include "targetver. H"

# Include <stdio. h>
# Include <tchar. h>

// Todo: Reference additional headers your program requires here
// Stdafx. h: Include File for standard system include files,
// Or project specific include files that are used frequently,
// Are changed infrequently

# Ifndef vc_extralean
# Define vc_extralean // exclude rarely-used stuff from Windows Headers
# Endif

# Include "targetver. H"

# DEFINE _ atl_cstring_explicit_constructors // some cstring constructors will be explicit

# Include <afxwin. h> // MFC core and standard components
# Include <afxext. h> // MFC extensions

# Ifndef _ afx_no_ole_support
# Include <afxole. h> // MFC Ole classes
# Include <afxodlgs. h> // mfc ole Dialog classes
# Include <afxdisp. h> // MFC automation classes
# Endif // _ afx_no_ole_support

# Ifndef _ afx_no_db_support
# Include <afxdb. h> // mfc odbc database classes
# Endif // _ afx_no_db_support

# Ifndef _ afx_no_dao_support
# Include <afxdao. h> // mfc dao database classes
# Endif // _ afx_no_dao_support

# Ifndef _ afx_no_ole_support
# Include <afxdtctl. h> // MFC support for Internet Explorer 4 common controls
# Endif
# Ifndef _ afx_no_afxcmn_support
# Include <afxcmn. h> // MFC support for Windows Common controls
# Endif // _ afx_no_afxcmn_support
# Include <afxcontrolbars. h>

/*
// Stdafx. h: Include File for standard system include files,
// Or project specific include files that are used frequently,
// Are changed infrequently

# Pragma once

# Ifndef vc_extralean
# Define vc_extralean // exclude rarely-used stuff from Windows Headers
# Endif

# Include "targetver. H"

# DEFINE _ atl_cstring_explicit_constructors // some cstring constructors will be explicit

# Include <afxwin. h> // MFC core and standard components
# Include <afxext. h> // MFC extensions

# Ifndef _ afx_no_ole_support
# Include <afxole. h> // MFC Ole classes
# Include <afxodlgs. h> // mfc ole Dialog classes
# Include <afxdisp. h> // MFC automation classes
# Endif // _ afx_no_ole_support

# Ifndef _ afx_no_db_support
# Include <afxdb. h> // mfc odbc database classes
# Endif // _ afx_no_db_support

# Ifndef _ afx_no_dao_support
# Include <afxdao. h> // mfc dao database classes
# Endif // _ afx_no_dao_support

# Ifndef _ afx_no_ole_support
# Include <afxdtctl. h> // MFC support for Internet Explorer 4 common controls
# Endif
# Ifndef _ afx_no_afxcmn_support
# Include <afxcmn. h> // MFC support for Windows Common controls
# Endif // _ afx_no_afxcmn_support

*/

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.