locked
Fatal Error C1189 Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d] RRS feed

  • Question

  • Hi

    I try to compile a c++ project under vs2010

    I get this error

    How can I rid from it ?

    Friday, November 26, 2010 5:26 PM

Answers

  • Go to the project properties (Project menu, Properties).  Set 'Use of MFC' to "Use MFC in a Shared DLL".  You have to make this change for both the debug and release configurations.
    • Marked as answer by amit1983 Friday, November 26, 2010 6:35 PM
    Friday, November 26, 2010 6:03 PM

All replies

  • Go to the project properties (Project menu, Properties).  Set 'Use of MFC' to "Use MFC in a Shared DLL".  You have to make this change for both the debug and release configurations.
    • Marked as answer by amit1983 Friday, November 26, 2010 6:35 PM
    Friday, November 26, 2010 6:03 PM
  • I am getting the same issue but I need to do static and not shared MFC Dll. My project was originally in VC2005 where I can build both with shared MFC dll or static build ("Use MFC in a Static Library"). After opening and converting it it in VC2010 I get this error with static build but shared MFC build works fine. How can I fix this with static build?
    Wednesday, March 16, 2011 6:32 PM
  • I am trying to fix this issue from so long. This error comes because managed .net code is used inside DLL library. If common language runtime support is removed from properties this error will not come. I am trying to deploy an application that uses shared mfc library and I tried everything but it does not work. I used merge module, private assemblies, etc. Every time I get error on deployment machine saying your side-by-side configuration is not correct. Can anyone help me please?
    Sunday, March 27, 2011 2:26 AM
  • In file StdAfx.cpp #define  _AFXDLL before #include "stdafx.h" like this

     

    #define _AFXDLL // this is now the first item in the file.

    #include "stdafx.h"

     

     

    Monday, June 13, 2011 6:48 PM
  • it compile but it not work's as expected

    Arun kumar non ascii
    Saturday, February 4, 2012 7:34 AM
  • thanks very much.

    quite helpful

    Tuesday, November 13, 2018 9:51 PM