您的位置:首页 > 移动开发

Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version 错误解决

2011-06-14 08:48 513 查看
2009-07-14 16:56

今天在VS2005中,用C++读取txt文本时,因为用得是CStdioFile类,所以要包含afx.h头文件,
例如:
#include <iostream>
#include <afx.h>
using namespace std;
void main()
{
cout<<"小孩,糖果/n";
}
但是当我导入该头文件时编译就出现了报错:
1>------ 已启动生成: 项目: test, 配置: Debug Win32 ------
1>正在编译...
1>win321.cpp
1>e:/vs2005/vc/atlmfc/include/afx.h(24) : 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]
1>生成日志保存在“file://e:/MyObject/test/test/test/Debug/BuildLog.htm”
1>test - 1 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========
解决方法:右击项目-->属性-->配置属性-->常规,然后在右边的“项目默认值”中的“MFC的使用”选项中选择“在共享 DLL 中使用 MFC”,在运行,解决了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐