建好了一个win32的dll工程,利用向导生成工程的时候,选择了"空工程"选项,自己写的DllMain函数.后来发现要使用到mfc的东西,在vs2008下,尝试了设置:在静态库中使用MFC和在共享dll中使用MFC,编译时出现下面错误:

WINDOWS.H already included. MFC apps must not #include <windows.h>

在网上找了一下,说的多的方法是: 

方法一:把#include <windows.h>去掉,另外在项目属性中选择使用MFC(建议用静态库)。

最好是重建项目,然后只要把现有的代码复制过来就可以。

方法二: 

在项目属性中选择配置属性->常规->MFC的使用(选择在静态库中使用MFC)

在stdafx.h中加入
include "afxwin.h"
去掉include "windows.h"

相关文章:

  • 2021-05-09
  • 2021-07-01
  • 2021-10-02
  • 2022-12-23
  • 2022-01-06
  • 2021-09-26
  • 2022-12-23
猜你喜欢
  • 2021-07-11
  • 2022-12-23
  • 2021-08-25
  • 2021-09-03
  • 2022-12-23
  • 2021-07-27
  • 2021-06-19
相关资源
相似解决方案