今天用VS2010编译一个vc6.0写的程序,没想到出了挺多问题,特地记录一下!
本身程序是在共享Dll中使用MFC,但为了在其他电脑也能运行,我改成了在静态库中使用MFC,于是出现下面错误:
c:\program files (x86)\microsoft visual studio 10.0\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]
双击错误来到这:
#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
在#error一行注释掉,出现下面错误:
1>nafxcwd.lib(appcore.obj) : error LNK2001: 无法解析的外部符号 ___argv
1>nafxcwd.lib(appcore.obj) : error LNK2001: 无法解析的外部符号 ___argc
1>nafxcwd.lib(afxglobals.obj) : error LNK2001: 无法解析的外部符号 _IID_IWICImagingFactory
百度了一下,修改项目属性——C/C++——代码生成——运行库,改为多线程调试(/MTD),
生成下,又出现错误:
1>nafxcwd.lib(afxglobals.obj) : error LNK2001: 无法解析的外部符号 _IID_IWICImagingFactory
继续百度,修改项目属性——链接器——输入——附加依赖项,添加windowscodecs.lib,
再生成,生成成功!