未解决的外部符号错误:无法解决

unresolved external symbol error: not able to solve it

本文关键字:解决 错误 外部 符号 未解决      更新时间:2023-10-16

编译代码时,出现以下未解决的外部符号错误。我正在使用第三方库。因此在编译代码时使用第三方库名称空间。

std_uss.obj:错误LNK2019:函数"private: char * __thiscall os_std::basic_string<char,class os_std::char_traits_char,class os_std::allocator<char> >::allocate(unsigned int)"(?allocate@?$basic_string@DVchar_traits_char@os_std@@V?$allocator@D@2@@os_std@@AAEPADI@Z)中引用的未解析外部符号"__declspec(dllimport) void __cdecl os_std::os_throw_length_error(void)"(__imp_?os_throw_length_error@os_std@@YAXXZ

我在第三部分库的一个文件中发现了os_throw_length_error函数,但在代码中没有发现任何类似于:allocater的函数。我并没有使用标准的std名称空间,因为我希望编译器使用第三方名称空间。

如果我使用标准的using namespace std,那么我的编译是成功的,但一些定义(如字符串)被引用到visualstudio字符串,而不是第三方字符串函数。

您需要将第三方DLL的导入库(.lib文件)添加到项目中。在Visual Studio中,这将在项目属性中的Linker/Input/Extremental Dependencies 下