Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/126.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在MFC中使用静态libraby_C++_Compiler Construction_Mfc_Linker_Static Libraries - Fatal编程技术网

C++ 在MFC中使用静态libraby

C++ 在MFC中使用静态libraby,c++,compiler-construction,mfc,linker,static-libraries,C++,Compiler Construction,Mfc,Linker,Static Libraries,我尝试在MFC项目中使用静态库,但出现以下链接器错误: 1>------ Build started: Project: Csetkliens, Configuration: Debug Win32 ------ 1>Build started 2012.05.20. 16:12:49. 1>InitializeBuildStatus: 1> Touching "Debug\Csetkliens.unsuccessfulbuild". 1>ClCompile: 1

我尝试在MFC项目中使用静态库,但出现以下链接器错误:

1>------ Build started: Project: Csetkliens, Configuration: Debug Win32 ------
1>Build started 2012.05.20. 16:12:49.
1>InitializeBuildStatus:
1>  Touching "Debug\Csetkliens.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>  All outputs are up-to-date.
1>ResourceCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) already defined in libcpmtd.lib(stdthrow.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in Csetkliens.obj
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in Csetkliens.obj
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in Csetkliens.obj
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: struct std::_Iterator_base12 * * __thiscall std::_Container_base12::_Getpfirst(void)const " (?_Getpfirst@_Container_base12@std@@QBEPAPAU_Iterator_base12@2@XZ) already defined in Csetkliens.obj
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmtd.lib(xthrow.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __invalid_parameter already defined in libcmtd.lib(invarg.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __CrtDbgReportW already defined in libcmtd.lib(dbgrptw.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in libcmtd.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in libcmtd.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in libcmtd.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _memmove already defined in libcmtd.lib(memmove.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _malloc already defined in libcmtd.lib(dbgmalloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _realloc already defined in libcmtd.lib(dbgrealloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _fflush already defined in libcmtd.lib(fflush.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: ___iob_func already defined in libcmtd.lib(_file.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _free already defined in libcmtd.lib(dbgfree.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _floor already defined in libcmtd.lib(_floor_pentium4_.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _ldexp already defined in libcmtd.lib(_ldexp_.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _abort already defined in libcmtd.lib(abort.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _isspace already defined in libcmtd.lib(_ctype.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>D:\Projektek\V.felev\Felulettervezes (MFC) - Halozatok\Csetkliens\Debug\Csetkliens.exe : fatal error LNK1169: one or more multiply defined symbols found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.29
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
静态库的名称是kriptolib.lib,它是我自己的产品。它不使用任何MFC。我想不出是什么问题

当我试图从kriptolib创建一个新对象时,问题就出现了

theApp.encryption = new RC4();

如果我对下面的行进行注释,编译器不会显示任何错误。

您需要将测试项目更改为使用MTd(多线程调试)

从属性页中选择配置属性==>C/C++==>Code Generation==>Runtime Library==>Multi-threaded Debug(/MTd)。