Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32 Project Generating MFC error

I am working on a Win32 project in Visual Studio 2010. it is generating an MFC error, the error is given below

error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

IntelliSense: #error directive: WINDOWS.H already included. MFC apps must not #include

My Question is why WIN32 project is generating MFC error, and how should i remove this error, kindly guide me

like image 713
WiXXeY Avatar asked Sep 09 '13 06:09

WiXXeY


2 Answers

The problem is that one of the headers you're including is including 'afx.h'. The first thing that header does is check to see if _DLL as been defined and if that's present it looks for _AFXDLL and shows this error message if it's not been defined. Here's the relevant bit from afx.h

#ifdef _DLL
#ifndef _AFXDLL
#error Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
#endif
#endif

If you don't want to include MFC go to your project properties and under C/C++ -> Advanced switch Show Includes ON to see where afx.h is being included.

like image 70
snowdude Avatar answered Oct 02 '22 17:10

snowdude


Could you try this:

Change

Project Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library

As

Multi-threaded DLL (/MD)

like image 34
Cihan T. Avatar answered Oct 02 '22 17:10

Cihan T.