[问题]
Hello all
I'm writing a managed C++ dll with will be acting as an intermediate between a lot of old unmanaged legacy C/C++ and a new C# WPF ui. While trying to compile it I'm getting this error: 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]
If I define _AFXDLL under the project properties Preprocessor Definitions I get this error: fatal error C1189: #error: WINDOWS.H already included. MFC apps must not #include <windows.h>
Command line error D8016: '/MTd' and '/clr' command-line options are incompatible
The problem seems to be the inclusion of "stdafx.h", which I need for common windows data types I'm going to marshal. What am I doing wrong? |
【答案】
Project + Properties, General. Ensure Use of MFC is set to "Use MFC in a Shared Library".