[问题]

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>


If I change the threading from /MD[ d] I get this error:

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".

 

From: https://social.msdn.microsoft.com/Forums/vstudio/en-US/553fa850-5e6e-4ecb-a4eb-bbd81f8ff6b6/managed-c-dll-define-afxdll-or-do-not-use-md-d?forum=vcgeneral

最新文章

  1. [Java入门笔记] Java语言基础(三):运算符
  2. ICEM(2)—机翼翼稍网格绘制
  3. datatables中columns.render的使用
  4. WebKit渲染基础(转载 学习中。。。)
  5. .net matlab 数据类型转换
  6. hdu 1042 N!
  7. Window 添加定时任务
  8. Lua学习笔记(二):基本语法
  9. vs2012如何创建报表
  10. eclipse 项目报错问题
  11. bzoj3230
  12. 关于 Swift
  13. redis源码分析之事务Transaction(上)
  14. Zabbix监控之迁移zabbix server
  15. oracle:批量插入不同方案对比
  16. Android P新功能特性抢先看
  17. Ibatis和Hibernate的比较
  18. hbuilder 个推 问题记录
  19. 2018牛客暑期ACM多校训练营第二场(有坑未填)
  20. SQL SERVER EXPRESS 连接字符串

热门文章

  1. 华为交换机VRRP配置实例收集(转)
  2. RabbitMQ消息交换模式简介
  3. 如何利用 jQuery 修改 css 中带有 !important 的样式属性?
  4. CF 427D Match &amp;amp; Catch 求最短唯一连续LCS
  5. FFMPEG采集摄像头数据并切片为iPhone的HTTP Stream流
  6. kernel logo到开机动画之间闪现黑屏(android 5.X)
  7. 一些 Google 搜索词
  8. iOS 各种控件默认高度(图示)
  9. jQuery Pagination分页插件
  10. eclipse新发现功能之dos和terminal(ssh连接)