做C++、C#和C++/CLI的混合编程有一段时间了,填了不少的坑。

今天又遇到一错误,想着挺容易就解决,估计是大脑疲惫,折腾许久才找到原因。

错误:

错误 C1189 #error: WINDOWS.H already included. MFC apps must not #include <Windows.h>

环境:

实际项目引用情况比较复杂,现简化如下:

A工程:VC++,B工程:C++/CLI,B引用A。

B工程中包含了A工程的头文件,同时包含了<msclr/marshal_cppstd.h>。

结论:

<msclr/marshal_cppstd.h>只能放在h文件中,即使只在cpp用到也只能放在h文件中,并且顺序必须在A工程头文件之后。

WINDOWS.H already included. MFC apps must not #include Windows.h的更多相关文章

  1. fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

    给对话框添加类, 报错 CalibrateMFCDlg.h(6) : error C2504: “CDialog”: 未定义基类 等多个错误 加上 #include "afxwin.h&qu ...

  2. MFC项目中包含atlimage.h导致fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

    因为要用到CImage所以包含了atlimage.h 报这个错误的话你只需要把atlimage.h放在afxwin.h的下方即可,不能让它在afxwin.h的上方

  3. MFC apps must not include windows.h

    用VS2008建立一个DLL项目,一开始的时候不想用MFC, 所以选择的是使用标准Windows库. 使用了一段时间后又想用MFC了,所以把选项改成使用在共享 DLL 中使用 MFC. 但是编译的时候 ...

  4. XCode里遇到 #include <XXX.h>file not found的解决方案

    最近在学习如何在C++里调用Java方法,遇到提示 #include <XXX.h> file  not  found 的问题.也google了好久都没有找到合适的解决方案. 认真的研究了 ...

  5. Windows Phone Silverlight 8.1 apps

    The Windows Phone Silverlight 8.1 app model gives Windows Phone 8 developers access to some of the n ...

  6. In file included from adlist.c:34:0: zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录

    问题: In file included from adlist.c:34:0:zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录 解决: make ...

  7. vc/atlmfc/include/afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT

    环境:win7,64位,vs2012 1> c:/program files/microsoft visual studio 8/vc/atlmfc/include/afx.h(24) : fa ...

  8. 在windows下使用pip安装python包遇到缺失stdint.h文件的错误

    今天在windows上使用pip安装一个python包python-lzf时遇到如下的错误: fatal error C1083: Cannot open include file: 'stdint. ...

  9. [Windows Azure] Adding Sign-On to Your Web Application Using Windows Azure AD

    Adding Sign-On to Your Web Application Using Windows Azure AD 14 out of 19 rated this helpful - Rate ...

  10. vs2017自动生成的#include“stdafx.h”详解及解决方案

    vs2017自动生成的#include“stdafx.h”详解及解决方案 问题描述: 在高版本的Visual Studio的默认设置中,会出现这么一个现象,在新建项目之后,项目会自动生成#includ ...

随机推荐

  1. Delphi dbgrideh颜色设置

    DBGridEh中分行分列.单元格的颜色设置(1)分行不同颜色设置:在DBGridEh1DrawColumnCell中写: if ADOQuery1.RecNo mod 2=0 then begin ...

  2. [数据库] 数据库中的DDL、DML、DQL、DCL

    SQL 程序语言有四种类型,对数据库的基本操作都属于这四种类,也就是标题上显示的 DDL.DML.DQL.DCL. 1. DDL DDL(Data Definition Language 数据定义语言 ...

  3. NebulaGraph入门介绍

    NebulaGraph入门介绍 什么是图数据库? 图数据库就会是存储图形网络并能从中检索信息的数据库. 图数据库在处理关联关系上有极大的优势,它以图论为理论基础,使用图模型,将关联数据的实体作为顶点( ...

  4. Python Rich:美化终端显示效果

    Rich库的功能就像它的名字一样,使Python编程更加丰富(rich),它帮助开发者在控制台(命令行)输出中创建丰富.多彩和具有格式化的文本. 本篇总结了如何使用Rich库让我们的命令行工具更加美观 ...

  5. 欧拉公式 Euler's Formula

    欧拉公式是数学中最重要的公式之一, 它涉及到了复数, 无理数, 三角函数, 简单优美 \(e^{i\theta} = cos(\theta) + isin(\theta)\) 欧拉公式代表的含义并不是 ...

  6. python绘图总结

    1 二维图像 1.1 二维曲线 plot(x, y, ls="-", lw=1.5, label=None) x, y:横坐标和纵坐标 ls:颜色.点标记.线型列表,如 ls='r ...

  7. 探秘SuperCLUE-Safety:为中文大模型打造的多轮对抗安全新框架

    探秘SuperCLUE-Safety:为中文大模型打造的多轮对抗安全新框架 进入2023年以来,ChatGPT的成功带动了国内大模型的快速发展,从通用大模型.垂直领域大模型到Agent智能体等多领域的 ...

  8. React 组件懒加载

    只有不断学习和成长,才能适应这个快速变化的世界. 1. 懒加载 1.1 React 懒加载 React 中懒加载 Lazy 与 Suspense 需要搭配使用. React.lazy 定义: Reac ...

  9. 01-Redis系列之-Redis介绍安装配置

    Redis初识 Redis主要内容 1 redis介绍,特性,安装和配置,典型应用场景 2 单线程架构,5大数据类型操作,通用指令和高级API的使用 3 高级用法(慢查询,管道,shu发布订阅,bit ...

  10. 问题:django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log rest_framework static tz

    django使用swagger自动生成API文档时,报错 解决方法 在settings.py里面配置一下以下代码 'libraries': { 'staticfiles': 'django.templ ...