MRXI
MRXI

Reputation: 109

Error C1189 MFC

I already searched for solutions online, but nothing helped me. I want to code a simple Chat in C++, everything is fine, but I get this error:

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]

I already defined

#define _AFXDLL

but the error is still occures. Any help is apprecicated!

Upvotes: 6

Views: 17223

Answers (1)

Igor Tandetnik
Igor Tandetnik

Reputation: 52471

There are two settings that must agree with each other:

  1. Project > Properties > General (now Advanced in VS2022) > Use of MFC

  2. Project > Properties > C/C++ / Code Generation / Runtime

Library

If (1) is set to Use MFC in static library, then (2) must be Multithreaded (/MT) or Multithreaded Debug (/MTd) (in Release and Debug builds, correspondingly). If (1) is Use MFC in Shared DLL, then (2) must be Multi-threaded DLL (/MD) or Multi-threaded Debug DLL (/MDd).

When the two don't agree, you get the error you've shown.

Upvotes: 12

Related Questions