win32程序中简单应用mfc

来源:互联网 发布:软件开发实例 编辑:程序博客网 时间:2024/05/10 04:31

今日写程序在win32中用CRect发现报错,突然想起来。要引入mfc库。想重新建立一个工程添加对mfc的支持。发现选项不能选。查资料后发现。

在win32程序中简单应用mfc库,只需要简单的引入<afx.h>就好了。注意这个时候如果出来

#ifdef _DLL
#ifndef _AFXDLL
#error Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
#endif
#endif

这个错误。只需要把use of mfc改为Use MFC in a Shared DLL就可以了。

当然<windows.h>头文件在mfc中已经包含所以去掉。

原创粉丝点击