我只要添加这个msvcrt.lib 就会无法使用string,出现无法解析外部命令,,这是为何,不添加这个的话,就可以使用string,,,

问题1:string类无法正常使用,出现无法解析外部命令

错误 LNK2019 无法解析的外部符号 __imp__invalid_parameter,函数 "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z) 中引用了该符号 ConsoleApplication_string_test E:\Abc\Visual C++ 2019\ConsoleApplication_string_test\ConsoleApplication_string_test.obj 1
错误 LNK2019 无法解析的外部符号 __imp__CrtDbgReport,函数 "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z) 中引用了该符号 ConsoleApplication_string_test E:\Abc\Visual C++ 2019\ConsoleApplication_string_test\ConsoleApplication_string_test.obj 1

解决方案:

去除掉,链接器->输入->附加依赖项---msvcrt.lib,就是因为这个msvcrt.lib的存在导致string无法正常使用,连编译都通不过去

未经授权不得转载,转载时请注明出处。