프로그래밍/C++

fatal error C1189

이재만박사 2019. 9. 18. 11:39


Console 에서 MFC를 사용할 때 다음 헤더 파일을 포함해야 한다


#include <afxext.h>


Console 에서 MFC 함수를 사용하면 다음과 같은 에러가 난다


fatal 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]


원인은 다음과 같다


MFC 공유 DLL을 사용하기 위해서는 MD 대신 MT 로 변경한다


구성 속성 - C/C++ - 코드 생성 - 런타임 라이브러리 - 다중 스레드(/MT)


그리고 전처리기 CONSOLE 대신 WIN32 와  _WINDOWS를 추가한다


NDEBUG;WIN32;_WINDOWS;%(PreprocessorDefinitions)