使用 assimp 库时 visual studio 中未解析的外部符号

unresolved external symbol in visual studio while using assimp library

我已经构建了 assimp 库并创建了 .lib 文件,现在我将其用于示例应用程序,但是当我尝试构建示例应用程序时,出现错误:

1>assimp.lib(FBXParser.obj) : error LNK2001: unresolved external symbol _inflate
1>assimp.lib(BlenderLoader.obj) : error LNK2019: unresolved external symbol _inflate referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@BlenderImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XGLLoader.obj) : error LNK2001: unresolved external symbol _inflate
1>assimp.lib(XFileParser.obj) : error LNK2001: unresolved external symbol _inflate
1>assimp.lib(unzip.obj) : error LNK2001: unresolved external symbol _inflate
1>assimp.lib(FBXParser.obj) : error LNK2001: unresolved external symbol _inflateEnd
1>assimp.lib(BlenderLoader.obj) : error LNK2019: unresolved external symbol _inflateEnd referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@BlenderImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XGLLoader.obj) : error LNK2001: unresolved external symbol _inflateEnd
1>assimp.lib(XFileParser.obj) : error LNK2001: unresolved external symbol _inflateEnd
1>assimp.lib(unzip.obj) : error LNK2001: unresolved external symbol _inflateEnd
1>assimp.lib(BlenderLoader.obj) : error LNK2019: unresolved external symbol _inflateInit2_ referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@BlenderImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XGLLoader.obj) : error LNK2001: unresolved external symbol _inflateInit2_
1>assimp.lib(XFileParser.obj) : error LNK2001: unresolved external symbol _inflateInit2_
1>assimp.lib(unzip.obj) : error LNK2001: unresolved external symbol _inflateInit2_
1>assimp.lib(AssbinLoader.obj) : error LNK2019: unresolved external symbol _uncompress referenced in function "public: virtual void __thiscall Assimp::AssbinImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@AssbinImporter@Assimp@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XFileParser.obj) : error LNK2019: unresolved external symbol _inflateSetDictionary referenced in function "public: __thiscall Assimp::XFileParser::XFileParser(class std::vector<char,class std::allocator<char> > const &)" (??0XFileParser@Assimp@@QAE@ABV?$vector@DV?$allocator@D@std@@@std@@@Z)
1>assimp.lib(XFileParser.obj) : error LNK2019: unresolved external symbol _inflateReset referenced in function "public: __thiscall Assimp::XFileParser::XFileParser(class std::vector<char,class std::allocator<char> > const &)" (??0XFileParser@Assimp@@QAE@ABV?$vector@DV?$allocator@D@std@@@std@@@Z)
1>assimp.lib(unzip.obj) : error LNK2019: unresolved external symbol _crc32 referenced in function _unzReadCurrentFile
1>assimp.lib(unzip.obj) : error LNK2019: unresolved external symbol _get_crc_table referenced in function _unzOpenCurrentFile3
1>assimp.lib(FBXParser.obj) : error LNK2019: unresolved external symbol _inflateInit_ referenced in function "void __cdecl Assimp::FBX::`anonymous namespace'::ReadBinaryDataArray(char,unsigned int,char const * &,char const *,class std::vector<char,class std::allocator<char> > &,class Assimp::FBX::Element const &)" (?ReadBinaryDataArray@?A0x110075d1@FBX@Assimp@@YAXDIAAPBDPBDAAV?$vector@DV?$allocator@D@std@@@std@@ABVElement@23@@Z)

根据我在那里阅读的内容 (http://assimp.sourceforge.net/main_features.html),该库依赖于 zlib。

我的猜测是您没有将 zlib.lib 链接到您的项目,或者 zlib 未使用 assimp 正确编译,这可以解释为什么缺少 _inflate 方法。