fatal error C1189: #error: Please use the /MD switch for _AFXDLL builds

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hetoby/article/details/52116869

fatal error C1189: #error: Please use the /MD switch for _AFXDLL builds

DLL从“Use MFC in a Shared DLL”改为“Use MFC in a Static Library”遇到了该问题。

检查Runtime Library设置:
Multi-threaded Debug (/MTd)
Multi-threaded (/MT)
正确。

那么问题出在哪里呢?
_AFXDLL 不能和静态链接MFC一起使用,所以去掉_AFXDLL或者_AFXEXT即可(_AFXDLL is never used with a static MFC build)。

DEBUG时没问题,RELEASE时出现afxver_.h(130) : fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds

08-16

DEBUG时没问题,RELEASE时:rn1、rn当project options为:rn/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Fp"Release/DY_SMGP.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c rn时,编译时出现:rn--------------------Configuration: DY_SMGP - Win32 Release--------------------rnCompiling...rnStdAfx.cpprnd:\vc_apps\dy_smgp\release\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsignedrnCompiling...rnDY_SMGP.cpprnDY_SMGPDlg.cpprnD:\VC_APPS\DY_SMGP\DayooPP.h(41) : warning C4091: 'typedef ' : ignored on left of 'struct DAYOODD_SUBMIT_RESP' when no variable is declaredrnGenerating Code...rnLinking...rnlibcmt.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrt.lib(MSVCRT.dll)rnlibcmt.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrt.lib(MSVCRT.dll)rnlibcmt.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrt.lib(MSVCRT.dll)rnlibcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)rnlibcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)rnlibcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)rnlibcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)rnmsvcrt.lib(MSVCRT.dll) : error LNK2005: __setmbcp already defined in libcmt.lib(mbctype.obj)rnLINK : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:libraryrnmsvcrt.lib(cinitexe.obj) : warning LNK4098: defaultlib "libcmt.lib" conflicts with use of other libs; use /NODEFAULTLIB:libraryrnlibcmt.lib(crt0.obj) : error LNK2001: unresolved external symbol _mainrnRelease/DY_SMGP.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnDY_SMGP.exe - 10 error(s), 4 warning(s)rnrnrn2、rn当project options为:rn/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Fp"Release/DY_SMGP.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c rn时,编译时出现:rnrn--------------------Configuration: DY_SMGP - Win32 Release--------------------rnCompiling...rnStdAfx.cpprnC:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxver_.h(130) : fatal error C1189: #error : Please use the /MD switch for _AFXDLL buildsrnError executing cl.exe.rnrnDY_SMGP.exe - 1 error(s), 0 warning(s)rnrn各路高手,如何解决?rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试