msvcprt.lib(MSVCP100.dll) 编译错误

2024-03-06 10:59

本文主要是介绍msvcprt.lib(MSVCP100.dll) 编译错误,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 

在添加外部库的时候出现了错误,如下。其实是某一方运行库设置的问题。

网友遇到类似情况 http://stackoverflow.com/questions/4917592/compiling-and-using-jsoncpp-on-visual-studio10-with-boost

请确认各个编译链接的部分使用了相同的运行库 (MD MT MDd MTd)

1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE_JPBD_J@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Init(void)" (?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: __thiscall std::basic_ios<char,struct std::char_traits<char> >::basic_ios<char,struct std::char_traits<char> >(void)" (??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: char __thiscall std::basic_ios<char,struct std::char_traits<char> >::fill(void)const " (?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Pninc(void)" (?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setp(char *,char *,char *)" (?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setp(char *,char *)" (?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::pbump(int)" (?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Gninc(void)" (?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::epptr(void)const " (?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setg(char *,char *,char *)" (?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::gbump(int)" (?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::egptr(void)const " (?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::pptr(void)const " (?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::pbase(void)const " (?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::gptr(void)const " (?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::eback(void)const " (?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_ostream<char,struct std::char_traits<char> >::~basic_ostream<char,struct std::char_traits<char> >(void)" (??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::imbue(class std::locale const &)" (?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sync(void)" (?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setbuf(char *,__int64)" (?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PAD_J@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::xsputn(char const *,__int64)" (?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE_JPBD_J@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::xsgetn(char *,__int64)" (?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE_JPAD_J@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::uflow(void)" (?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::showmanyc(void)" (?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE_JXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAEXXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAEXXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __int64 __thiscall std::ios_base::width(__int64)" (?width@ios_base@std@@QAE_J_J@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __int64 __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBE_JXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: int __thiscall std::ios_base::rdstate(void)const " (?rdstate@ios_base@std@@QBEHXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::locale::facet::_Incref(void)" (?_Incref@facet@locale@std@@QAEXXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::locale::id::operator unsigned int(void)" (??Bid@locale@std@@QAEIXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in JSONCPP.lib(json_reader.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in JSONCPP.lib(json_reader.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::_Container_base0::_Orphan_all(void)" (?_Orphan_all@_Container_base0@std@@QAEXXZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: bool __thiscall std::basic_istream<char,struct std::char_traits<char> >::_Ipfx(bool)" (?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z) already defined in JSONCPP.lib(json_reader.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::snextc(void)" (?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ) already defined in JSONCPP.lib(json_reader.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sgetc(void)" (?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ) already defined in JSONCPP.lib(json_reader.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::locale __thiscall std::ios_base::getloc(void)const " (?getloc@ios_base@std@@QBE?AVlocale@2@XZ) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: static unsigned int __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *,class std::locale const *)" (?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z) already defined in JSONCPP.lib(json_writer.obj)
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: bool __thiscall std::ctype<char>::is(short,char)const " (?is@?$ctype@D@std@@QBE_NFD@Z) already defined in JSONCPP.lib(json_reader.obj)
1>libcpmt.lib(ios.obj) : error LNK2005: "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd@ios_base@std@@SAXPAV12@@Z) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(ios.obj) : error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static void __cdecl std::locale::facet::_Facet_Register(class std::locale::facet *)" (?_Facet_Register@facet@locale@std@@CAXPAV123@@Z) already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprt.lib(MSVCP100.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP100.dll)
1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(lconv.obj) : error LNK2005: _localeconv already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: "public: void __thiscall type_info::_type_info_dtor_internal_method(void)" (?_type_info_dtor_internal_method@type_info@@QAEXXZ) already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in MSVCRT.lib(ti_inst.obj)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in MSVCRT.lib(ti_inst.obj)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR100.dll)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRT.lib(crtexe.obj)
1>LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR100.dll)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

 

 

 

 

以上这些问题,看起来是关于 C++运行时 编译设置的问题,请确保你的编译符合以下选项:

  • 多线程静态库                    Multithreaded (/MT)
  • 多线程动态库                    Multithreaded DLL (/MD)
  • 多线程静态DEBUG库          Multithreaded Debug (/MTd)
  • 多线程动态DEBUG库          Multithreaded Debug DLL (/MDd)

所有相关的工程设置需要一致,如果违反了统一定义规则(不同选项会牵连一堆不同的相关配置),会导致你所观察到的运行效果不一样。

 

 

All of the errors are indicative of wrong C runtime settings with your builds. Make sure that all of your object files, libraries, etc are compiled with the same runtime setting, that is:

  • Multithreaded (/MT)
  • Multithreaded DLL (/MD)
  • Multithreaded Debug (/MTd)
  • Multithreaded Debug DLL (/MDd)

If this setting isn't the same for all the projects, you've violated the one definition rule (because each C runtime defines things differently) which would result in the behavior you're seeing.

My guess is that the JSONCPP library is being built assuming the static version of the standard library (/MT), while your code is using the Visual Studio default, which is the dynamically linked version (/MD).

You can change this setting from within Visual Studio by selecting the project properties for your project, going to C/C++ -> Code Generation, and changing the Runtime dropdown box.

 

---------------------------------------------------------------------------------------------------------------------------

https://msdn.microsoft.com/en-us/library/abx4dbyh(v=VS.100).aspx

C Run-Time Libraries

Visual Studio 2010
Other Versions

 

This topic discusses the various .lib files that comprise the C run-time libraries as well as their associated compiler options and preprocessor directives.

C Run-Time Libraries (CRT)

The following libraries contain the C run-time library functions.

C run-time library (without iostream or standard C++ library)

Associated DLL

Characteristics

Option

Preprocessor directives

libcmt.lib

None, static link.

Multithreaded, static link

/MT

_MT

msvcrt.lib

msvcr100.dll

Multithreaded, dynamic link (import library for MSVCR100.DLL). Be aware that if you use the Standard C++ Library, your program will need MSVCP100.DLL to run.

/MD

_MT, _DLL

libcmtd.lib

None, static link

Multithreaded, static link (debug)

/MTd

_DEBUG, _MT

msvcrtd.lib

msvcr100d.dll

Multithreaded, dynamic link (import library for MSVCR100D.DLL) (debug).

/MDd

_DEBUG, _MT, _DLL

msvcmrt.lib

None, static link

C Runtime static library. Used for mixed managed/native code.

/clr

/clr:oldSyntax

 

msvcurt.lib

None, static link

C Runtime static library compiled as 100% pure MSIL code. All code complies with the ECMA URT spec for MSIL.

/clr:pure

 

NoteNote

The single-threaded CRT (libc.lib, libcd.lib) (formerly the /ML or /MLd options) is no longer available. Instead, use the multithreaded CRT. SeeMultithreaded Libraries Performance.

If you link your program from the command line without a compiler option that specifies a C run-time library, the linker will use LIBCMT.LIB. This is different from previous versions of Visual C++ which used LIBC.LIB, the single-threaded library, instead.

Using the statically linked CRT implies that any state information saved by the C runtime library will be local to that instance of the CRT. For example, if you use strtok, _strtok_l, wcstok, _wcstok_l, _mbstok, _mbstok_l when using a statically linked CRT, the position of the strtok parser is unrelated to the strtok state used in code in the same process (but in a different DLL or EXE) that is linked to another instance of the static CRT. In contrast, the dynamically linked CRT shares state for all code within a process that is dynamically linked to the CRT. This concern does not apply if you use the new more secure versions of these functions; for example, strtok_s does not have this problem.

Because a DLL built by linking to a static CRT will have its own CRT state, it is not recommended to link statically to the CRT in a DLL unless the consequences of this are specifically desired and understood. For example, if you call _set_se_translator in an executable that loads the DLL linked to its own static CRT, any hardware exceptions generated by the code in the DLL will not be caught by the translator, but hardware exceptions generated by code in the main executable will be caught.

If you are using the /clr compiler switch, your code will be linked with a static library, msvcmrt.lib. The static library provides a proxy between your managed code and the native CRT. You cannot use the statically linked CRT ( /MT or /MTd options) with /clr. Use the dynamically-linked libraries (/MD or /MDd) instead.

If you are using the /clr:pure compiler switch, your code will be linked with the static library msvcurt.lib. As with /clr, you cannot link with the statically linked library.

For more information on using the CRT with /clr, see Mixed (Native and Managed) Assemblies; for /clr:pure, see Pure and Verifiable Code (C++/CLI).

To build a debug version of your application, the _DEBUG flag must be defined and the application must be linked with a debug version of one of these libraries. For more information about using the debug versions of the library files, see CRT Debugging Techniques.

This version of Visual C++ is not conformant with the C99 standard.

Standard C++ Library

Standard C++ Library

Characteristics

Option

Preprocessor directives

LIBCPMT.LIB

Multithreaded, static link

/MT

_MT

MSVCPRT.LIB

Multithreaded, dynamic link (import library for MSVCP100.dll)

/MD

_MT, _DLL

LIBCPMTD.LIB

Multithreaded, static link

/MTd

_DEBUG, _MT

MSVCPRTD.LIB

Multithreaded, dynamic link (import library for MSVCP100D.DLL)

/MDd

_DEBUG, _MT, _DLL

Note   LIBCP.LIB and LIBCPD.LIB (via the old /ML and /MLd options) have been removed. Use LIBCPMT.LIB and LIBCPMTD.LIB instead via the /MTand /MTd options.

When you build a release version of your project, one of the basic C run-time libraries (LIBCMT.LIB, MSVCMRT.LIB, MSVCRT.LIB) is linked by default, depending on the compiler option you choose (multithreaded, DLL, /clr). If you include one of the Header Files in your code, a Standard C++ Library will be linked in automatically by Visual C++ at compile time. For example:

#include <ios> 

What is the difference between msvcrt.dll and msvcr100.dll?

The msvcrt.dll is now a "known DLL," meaning that it is a system component owned and built by Windows. It is intended for future use only by system-level components.

What problems exist if an application uses both msvcrt.dll and msvcr100.dll?

If you have a .lib or .obj file that needs to link to msvcrt.lib, then you should not have to recompile it to work with the new msvcrt.lib in Visual C++ 2010. The .lib or .obj file may rely on the sizes, field offsets, or member function names of various CRT classes or variables, and those should all still exist in a compatible way. When you relink against msvcrt.lib, your final EXE and DLL image will now have a dependency on msvcr100.dll instead of msvcrt.dll.

If you have more than one DLL or EXE, then you may have more than one CRT, whether or not you are using different versions of Visual C++. For example, statically linking the CRT into multiple DLLs can present the same problem. Developers encountering this problem with static CRTs have been instructed to compile with /MD to use the CRT DLL. Now that the CRT DLL has been renamed to msvcr100.dll, applications may have some components linked to msvcrt.dll and others to msvcr100.dll. If your DLLs pass CRT resources across the msvcrt.dll and msvcr100.dll boundary, you will encounter issues with mismatched CRTs and need to recompile your project with Visual C++ 2010.

If your program is using more than one version of the CRT, some care is needed when passing certain CRT objects (such as file handles, locales and environment variables) across DLL boundaries. For more information on the issues involved and how to resolve them, see Potential Errors Passing CRT Objects Across DLL Boundaries.

 

 

 

----------------------------------------------------------------------------------------------------------------------

http://www.cnblogs.com/huashiyiqike/articles/2990126.html

分类: VC/C++
多线程 dll 编译器 library thread c

三、功能

  运行时库是程序在运行时所需要的库文件,通常以LIB或DLL形式提供:

  C运行时库                               库文件
  Single thread(static link)              libc.lib
  Debug single thread(static link)        libcd.lib
  MultiThread(static link)                libcmt.lib
  Debug multiThread(static link)          libcmtd.lib
  MultiThread(dynamic link)               msvcrt.lib
  Debug multiThread(dynamic link)         msvcrtd.lib

  C运行时库包含了C程序运行的最基本和最常用的函数。

  C运行时库除了给我们提供必要的库函数调用之外,它提供的另一个最重要的功能是为应用程序添加启动函数。

  C运行时库启动函数的主要功能为进行程序的初始化,对全局变量进行赋初值,加载用户程序的入口函数。

四、编译器链接选项

  VC带的编译器名字叫cl.exe,它有几个与标准程序库有关的选项:/ML、/MLd、/MT、/MTd、/MD、/MDd。编译时到底哪个C运行时库联入程序取决于这些编译选项,选项告诉编译器应用程序想使用什么版本的C标准程序库:

  /ML对应单线程静态版的标准程序库(libc.lib);
  /MT对应多线程静态版标准库(libcmt.lib),此时编译器会自动定义_MT宏;
  /MD对应多线程DLL版(导入库msvcrt.lib,DLL是msvcrt.dll),编译器自动定义_MT和_DLL两个宏。

  后面加d的选项都会让编译器自动多定义一个_DEBUG宏,表示要使用对应标准库的调试版,因此:

  /MLd对应调试版单线程静态标准库(libcd.lib);
  /MTd对应调试版多线程静态标准库(libcmtd.lib);
  /MDd对应调试版多线程DLL标准库(导入库msvcrtd.lib,DLL是msvcrtd.dll)。

  即:

  /ML 使用LIBC.lib创建单线程可执行文件
  /MLd 使用LIBCD.lib创建调试单线程可执行文件
  /MT 使用LIBCMT.lib创建多线程可执行文件
  /MTd 使用LIBCMTD.lib创建调试多线程可执行文件
  /MD 使用MSVCRT.lib创建多线程DLL
  /MDd 使用MSVCRTD.lib创建调试多线程DLL

  说明:

  (1)静态链接的单线程库

  静态链接的单线程库只能用于单线程的应用程序,C运行时库的目标代码最终被编译在应用程序的二进制文件中。
  通过/ML编译选项可以设置Visual C++使用静态链接的单线程库。

  (2)静态链接的多线程库

  静态链接的多线程库的目标代码也最终被编译在应用程序的二进制文件中,但是它可以在多线程程序中使用。
  通过/MT编译选项可以设置Visual C++使用静态链接的多线程库。

  (3)动态链接的运行时库

  动态链接的运行时库将所有的C库函数保存在一个单独的动态链接库MSVCRTxx.DLL中,MSVCRTxx.DLL处理了多线程问题。
  使用/MD编译选项可以设置Visual C++使用动态链接的运行时库。

  /MLd、/MTd或/MDd选项使用Debug Runtime Library(调试版本的运行时刻函数库),与/ML、/MT或/MD分别对应。Debug版本的Runtime Library包含了调试信息,并采用了一些保护机制以帮助发现错误,加强了对错误的检测,因此在运行性能方面比不上Release版本。

  程序运行时,很大一部分时间是在这些运行库里运行。在程序(Release版)被编译时,VC会根据编译选项(单线程、多线程或DLL)自动将相应的运行时库文件(libc.lib、libcmt.lib或Import library msvcrt.lib)链接进来。

  注:修改编译选项,将/MD或/MDd改为/MT或/MTd,就实现了对VC运行时库的静态链接,在运行时就不再需要VC的dll了。

五、附:

  下面是MSDN关于Visual C++编译器选项的说明:

  这些选项选择单线程或多线程运行时例程,指示多线程模块是否为DLL,并选择运行时库的发布版本或调试版本。

  /MD

  使应用程序使用运行时库的多线程并特定于DLL的版本。定义_MT和_DLL,并使编译器将库名MSVCRT.lib放入.obj文件中。
  用此选项编译的应用程序静态链接到MSVCRT.lib。该库提供允许链接器解析外部引用的代码层。实际工作代码包含在MSVCR80.DLL中,该库必须在运行时对于与MSVCRT.lib链接的应用程序可用。
  当在定义了_STATIC_CPPLIB(/D_STATIC_CPPLIB)的情况下使用/MD时,它将导致应用程序与静态多线程标准C++库(libcpmt.lib)而非动态版本(msvcprt.lib)链接,同时仍通过msvcrt.lib动态链接到主CRT。

  /MDd

  定义_DEBUG、_MT和_DLL,并使应用程序使用运行时库的调试多线程并特定于DLL的版本。它还使编译器将库名MSVCRTD.lib放入.obj文件中。

  /ML

  使编译器将库名LIBC.lib放入.obj文件中,以便链接器使用LIBC.lib解析外部符号。这是编译器的默认操作。LIBC.lib不提供多线程支持。

  /MLd

  定义_DEBUG并使编译器将库名LIBCD.lib放入.obj文件中,以便链接器使用LIBCD.lib解析外部符号。LIBCD.lib不提供多线程支持。

  /MT

  使应用程序使用运行时库的多线程静态版本。定义_MT并使编译器将库名LIBCMT.lib放入.obj文件中,以便链接器使用LIBCMT.lib解析外部符号。

  /MTd

  定义_DEBUG和_MT。此选项还使编译器将库名LIBCMTD.lib放入.obj文件中,以便链接器使用LIBCMTD.lib解析外部符号。

  /LD

  创建 DLL。
  将/DLL选项传递到链接器。链接器查找DllMain函数,但并不需要该函数。如果没有编写 DllMain函数,链接器将插入返回TRUE的DllMain函数。
  链接DLL启动代码。
  如果命令行上未指定导出(.exp)文件,则创建导入库(.lib);将导入库链接到调用您的DLL的应用程序。
  将/Fe(命名EXE文件)解释为命名DLL而不是.exe文件;默认程序名成为basename.dll而不是basename.exe。
  除非显式指定/MD,否则将暗指/MT。

  /LDd

  创建调试DLL。定义_MT和_DEBUG。

  警告

  不要混合使用运行时库的静态版本和动态版本。在一个进程中有多个运行时库副本会导致问题,因为副本中的静态数据不与其他副本共享。链接器禁止在.exe文件内部既使用静态版本又使用动态版本链接,但您仍可以使用运行时库的两个(或更多)副本。例如,当与用动态(DLL)版本的运行时库链接的.exe文件一起使用时,用静态(非DLL)版本的运行时库链接的动态链接库可能导致问题。(还应该避免在一个进程中混合使用这些库的调试版本和非调试版本)。

  注:/ML、/MLd貌似已经不提供;另,LIBC.LIB,LIBCMT.LIB和MSVCRT.LIB有对应的LIBCP.LIB,LIBCPMT.LIB和MSVCPRT.LIB,作用不清楚,不知道是升级替换版本还是升级补充版本或其他功能,待续-_-!...OY~orz

 

转载于:https://www.cnblogs.com/Again/p/6611486.html

这篇关于msvcprt.lib(MSVCP100.dll) 编译错误的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/779853

相关文章

maven 编译构建可以执行的jar包

💝💝💝欢迎莅临我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:「stormsha的主页」👈,「stormsha的知识库」👈持续学习,不断总结,共同进步,为了踏实,做好当下事儿~ 专栏导航 Python系列: Python面试题合集,剑指大厂Git系列: Git操作技巧GO

【LabVIEW学习篇 - 21】:DLL与API的调用

文章目录 DLL与API调用DLLAPIDLL的调用 DLL与API调用 LabVIEW虽然已经足够强大,但不同的语言在不同领域都有着自己的优势,为了强强联合,LabVIEW提供了强大的外部程序接口能力,包括DLL、CIN(C语言接口)、ActiveX、.NET、MATLAB等等。通过DLL可以使用户很方便地调用C、C++、C#、VB等编程语言写的程序以及windows自带的大

Windows环境利用VS2022编译 libvpx 源码教程

libvpx libvpx 是一个开源的视频编码库,由 WebM 项目开发和维护,专门用于 VP8 和 VP9 视频编码格式的编解码处理。它支持高质量的视频压缩,广泛应用于视频会议、在线教育、视频直播服务等多种场景中。libvpx 的特点包括跨平台兼容性、硬件加速支持以及灵活的接口设计,使其可以轻松集成到各种应用程序中。 libvpx 的安装和配置过程相对简单,用户可以从官方网站下载源代码

【经验交流】修复系统事件查看器启动不能时出现的4201错误

方法1,取得『%SystemRoot%\LogFiles』文件夹和『%SystemRoot%\System32\wbem』文件夹的权限(包括这两个文件夹的所有子文件夹的权限),简单点说,就是使你当前的帐户拥有这两个文件夹以及它们的子文件夹的绝对控制权限。这是最简单的方法,不少老外说,这样一弄,倒是解决了问题。不过对我的系统,没用; 方法2,以不带网络的安全模式启动,运行命令行,输入“ne

PHP7扩展开发之函数方式使用lib库

前言 首先说下什么是lib库。lib库就是一个提供特定功能的一个文件。可以把它看成是PHP的一个文件,这个文件提供一些函数方法。只是这个lib库是用c或者c++写的。 使用lib库的场景。一些软件已经提供了lib库,我们就没必要再重复实现一次。如,原先的mysql扩展,就是使用mysql官方的lib库进行的封装。 在本文,我们将建立一个简单的lib库,并在扩展中进行封装调用。 代码 基础

PHP7扩展开发之对象方式使用lib库

前言 上一篇文章,我们使用的是函数方式调用lib库。这篇文章我们将使用对象的方式调用lib库。调用代码如下: <?php $hello = new hello(); $result = $hello->get(); var_dump($result); ?> 我们将在扩展中实现hello类。hello类中将依赖lib库。 代码 基础代码 这个扩展,我们将在say扩展上增加相关代码。sa

Golang test编译使用

创建文件my_test.go package testsimport "testing"func TestMy(t *testing.T) {t.Log("TestMy")} 通常用法: $ go test -v -run TestMy my_test.go=== RUN TestMyTestMy: my_test.go:6: TestMy--- PASS: TestMy (0.

SQL2005 性能监视器计数器错误解决方法

【系统环境】 windows 2003 +sql2005 【问题状况】 用户在不正当删除SQL2005后会造成SQL2005 性能监视器计数器错误,如下图 【解决办法】 1、在 “开始” --> “运行”中输入 regedit,开启注册表编辑器,定位到 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVer

什么是Lib

概念 LIB有两种: 一种是静态库,比如C-Runtime库,这种LIB中有函数的实现代码,一般用在静态连编上,它是将LIB中的代码加入目标模块(EXE或者DLL)文件中,所以链接好了之后,LIB文件就没有用了。一种LIB是和DLL配合使用的,里面没有代码,代码在DLL中,这种LIB是用在静态调用DLL上的,所以起的作用也是链接作用,链接完成了,LIB也没用了。至于动态调用DLL的话,根本用不