解决 LNK4098:defaultlib 'MSVCRT' 与 (DCMTK) 和 LNK2038/LNK2005 冲突

Resolving LNK4098: defaultlib 'MSVCRT' conflicts with (DCMTK) and LNK2038/LNK2005

我在 Visual Studio 2013 年的项目中使用 C++ 语言的 DCMTK 3.6.1 库。我的代码在 Debug 模式下运行良好,但在 Release 模式下运行不正常;当我尝试编译它时,我有 275 个错误,都是这样的:

dcmdata.lib(dcdatset.obj):错误 LNK2038:检测到

不匹配
'_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in testapp_new.obj
2>dcmdata.lib(dcdatset.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in testapp_new.obj
2>dcmdata.lib(dcfilefo.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in testapp_new.obj
2>dcmdata.lib(dcfilefo.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in testapp_new.obj
2>dcmdata.lib(dcxfer.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in testapp_new.obj
2>dcmdata.lib(dcxfer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in testapp_new.obj
2>dcmdata.lib(dctagkey.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in testapp_new.obj
2>dcmdata.lib(dctagkey.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in testapp_new.obj
2>dcmdata.lib(dctag.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in testapp_new.obj
2>dcmdata.lib(dctag.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in testapp_new.obj
2>dcmdata.lib(dcstack.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in testapp_new.obj

我尝试了很多在网上找到的解决方案,但没有任何效果...

如果我尝试在 Release 模式下编译 DCMTL 库,我会遇到以下错误:

Error   4   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmdjpls.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(intrface.obj)
Error   5   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmdjpls.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(header.obj)
Error   6   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmdjpls.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(jpegls.obj)
Error   7   error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(invarg.obj)
Error   8   error LNK2005: ___crtSetUnhandledExceptionFilter already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   9   error LNK2005: ___crtTerminateProcess already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   10  error LNK2005: ___crtUnhandledException already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   11  error LNK2005: ___iob_func already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   12  error LNK2005: __lock_file already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   13  error LNK2005: __unlock_file already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   14  error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(fflush.obj)
Error   15  error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   16  error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   17  error LNK2005: __exit already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   18  error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   19  error LNK2005: _exit already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   20  error LNK2005: __errno already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(dosmap.obj)
Error   21  error LNK2005: __calloc_crt already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crtheap.obj)
Error   22  error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(hooks.obj)
Error   23  error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   24  error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   25  error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   26  error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   27  error LNK2005: __get_osfhandle already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(osfinfo.obj)
Error   28  error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(errmode.obj)
Error   29  error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winxfltr.obj)
Error   30  error LNK2005: __lock already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(mlock.obj)
Error   31  error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(mlock.obj)
Error   32  error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(wsetloca.obj)
Error   33  error LNK2005: __fileno already defined in LIBCMT.lib(fileno.obj)   C:\dcmtk-bin_2\dcmjpls\apps\MSVCRT.lib(MSVCR120.dll)
Warning 34  warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library    C:\dcmtk-bin_2\dcmjpls\apps\LINK
Warning 35  warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library    C:\dcmtk-bin_2\dcmjpls\apps\LINK
Error   36  error LNK1169: one or more multiply defined symbols found   C:\dcmtk-bin_2\bin\Release\dcmdjpls.exe
Error   37  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcml2pnm.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(intrface.obj)
Error   38  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcml2pnm.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(header.obj)
Error   39  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcml2pnm.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(jpegls.obj)
Error   40  error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(invarg.obj)
Error   41  error LNK2005: ___crtSetUnhandledExceptionFilter already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   42  error LNK2005: ___crtTerminateProcess already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   43  error LNK2005: ___crtUnhandledException already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   44  error LNK2005: ___iob_func already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   45  error LNK2005: __lock_file already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   46  error LNK2005: __unlock_file already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   47  error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(fflush.obj)
Error   48  error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   49  error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   50  error LNK2005: __exit already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   51  error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   52  error LNK2005: _exit already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   53  error LNK2005: __errno already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(dosmap.obj)
Error   54  error LNK2005: __calloc_crt already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crtheap.obj)
Error   55  error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(hooks.obj)
Error   56  error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   57  error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   58  error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   59  error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   60  error LNK2005: __get_osfhandle already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(osfinfo.obj)
Error   61  error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(errmode.obj)
Error   62  error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winxfltr.obj)
Error   63  error LNK2005: __lock already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(mlock.obj)
Error   64  error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(mlock.obj)
Error   65  error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(wsetloca.obj)
Error   66  error LNK2005: __fileno already defined in LIBCMT.lib(fileno.obj)   C:\dcmtk-bin_2\dcmjpls\apps\MSVCRT.lib(MSVCR120.dll)
Warning 67  warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library    C:\dcmtk-bin_2\dcmjpls\apps\LINK
Warning 68  warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library    C:\dcmtk-bin_2\dcmjpls\apps\LINK
Error   69  error LNK1169: one or more multiply defined symbols found   C:\dcmtk-bin_2\bin\Release\dcml2pnm.exe
Error   70  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmcjpls.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(intrface.obj)
Error   71  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmcjpls.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(header.obj)
Error   72  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmcjpls.obj C:\dcmtk-bin_2\dcmjpls\apps\charls.lib(jpegls.obj)
Error   73  error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(invarg.obj)
Error   74  error LNK2005: ___crtSetUnhandledExceptionFilter already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   75  error LNK2005: ___crtTerminateProcess already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   76  error LNK2005: ___crtUnhandledException already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winapisupp.obj)
Error   77  error LNK2005: ___iob_func already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   78  error LNK2005: __lock_file already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   79  error LNK2005: __unlock_file already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(_file.obj)
Error   80  error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(fflush.obj)
Error   81  error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   82  error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   83  error LNK2005: __exit already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   84  error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   85  error LNK2005: _exit already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0dat.obj)
Error   86  error LNK2005: __errno already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(dosmap.obj)
Error   87  error LNK2005: __calloc_crt already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crtheap.obj)
Error   88  error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(hooks.obj)
Error   89  error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   90  error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   91  error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   92  error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(crt0init.obj)
Error   93  error LNK2005: __get_osfhandle already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(osfinfo.obj)
Error   94  error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(errmode.obj)
Error   95  error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(winxfltr.obj)
Error   96  error LNK2005: __lock already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(mlock.obj)
Error   97  error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(mlock.obj)
Error   98  error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmjpls\apps\LIBCMT.lib(wsetloca.obj)
Error   99  error LNK2005: __fileno already defined in LIBCMT.lib(fileno.obj)   C:\dcmtk-bin_2\dcmjpls\apps\MSVCRT.lib(MSVCR120.dll)
Warning 100 warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library    C:\dcmtk-bin_2\dcmjpls\apps\LINK
Warning 101 warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library    C:\dcmtk-bin_2\dcmjpls\apps\LINK
Error   102 error LNK1169: one or more multiply defined symbols found   C:\dcmtk-bin_2\bin\Release\dcmcjpls.exe
Error   103 error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmsend.obj  C:\dcmtk-bin_2\dcmnet\apps\charls.lib(intrface.obj)
Error   104 error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmsend.obj  C:\dcmtk-bin_2\dcmnet\apps\charls.lib(header.obj)
Error   105 error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in dcmsend.obj  C:\dcmtk-bin_2\dcmnet\apps\charls.lib(jpegls.obj)
Error   106 error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(invarg.obj)
Error   107 error LNK2005: ___crtSetUnhandledExceptionFilter already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(winapisupp.obj)
Error   108 error LNK2005: ___crtTerminateProcess already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(winapisupp.obj)
Error   109 error LNK2005: ___crtUnhandledException already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(winapisupp.obj)
Error   110 error LNK2005: ___iob_func already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(_file.obj)
Error   111 error LNK2005: __lock_file already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(_file.obj)
Error   112 error LNK2005: __unlock_file already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(_file.obj)
Error   113 error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(fflush.obj)
Error   114 error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0dat.obj)
Error   115 error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0dat.obj)
Error   116 error LNK2005: __exit already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0dat.obj)
Error   117 error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0dat.obj)
Error   118 error LNK2005: _exit already defined in MSVCRT.lib(MSVCR120.dll)    C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0dat.obj)
Error   119 error LNK2005: __errno already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(dosmap.obj)
Error   120 error LNK2005: __calloc_crt already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crtheap.obj)
Error   121 error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(hooks.obj)
Error   122 error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0init.obj)
Error   123 error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0init.obj)
Error   124 error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0init.obj)
Error   125 error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(crt0init.obj)
Error   126 error LNK2005: __get_osfhandle already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(osfinfo.obj)
Error   127 error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR120.dll)  C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(errmode.obj)
Error   128 error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(winxfltr.obj)
Error   129 error LNK2005: __lock already defined in MSVCRT.lib(MSVCR120.dll)   C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(mlock.obj)
Error   130 error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(mlock.obj)
Error   131 error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR120.dll) C:\dcmtk-bin_2\dcmnet\apps\LIBCMT.lib(wsetloca.obj)
Error   132 error LNK2005: __fileno already defined in LIBCMT.lib(fileno.obj)   C:\dcmtk-bin_2\dcmnet\apps\MSVCRT.lib(MSVCR120.dll)

你知道如何解决这个问题吗?

也许您使用的库是具有不同 VS 版本的编译器。所以只有重新编译你得到的库才能解决这个问题。

或者您使用了不同的设置来使用 CRT(静态和动态链接)。

看看readmes!他们没有提到 VS-2013!

您是否可以使用编译器标志来忽略默认库?如果您使用由其他 VS 版本创建的静态库,这绝不是一个好方法。

您正在混合 Debug/Release 和 Dynamic/Static 库。

第一步,你有

mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease'

第二关,你有:

mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'

因此您将动态+调试替换为静态+发布。你解决了一半的问题却搞砸了另一半!

我建议重新编译库,但在动态+发布配置中。或者在static+release配置下编译你的项目,当然你想要什么取决于你。

根据 DCMTK 官方论坛中的建议,我重新编译了禁用标志 DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS 的 DCMTK 库,现在我可以在 Debug/Release 模式下编译,如此有效!

我需要在调试模式下安装库,然后在发布模式下安装

无论如何,我会对此进行更多调查。