我正在尝试使用msvc2010编译Qt 5.5应用程序。但是每当我尝试构建它时,我都会遇到几个与boost :: iostreams相关的链接器错误。
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall boost::iostreams::detail::gzip_header::reset(void)" (?reset@gzip_header@detail@iostreams@boost@@QAEXXZ) referenced in function "public: __thiscall boost::iostreams::detail::gzip_header::gzip_header(void)" (??0gzip_header@detail@iostreams@boost@@QAE@XZ)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall boost::iostreams::detail::gzip_footer::reset(void)" (?reset@gzip_footer@detail@iostreams@boost@@QAEXXZ) referenced in function "public: __thiscall boost::iostreams::detail::gzip_footer::gzip_footer(void)" (??0gzip_footer@detail@iostreams@boost@@QAE@XZ)
packagehandler.obj:-1: error: LNK2001: unresolved external symbol "int const boost::iostreams::zlib::default_compression" (?default_compression@zlib@iostreams@boost@@3HB)
packagehandler.obj:-1: error: LNK2001: unresolved external symbol "int const boost::iostreams::zlib::deflated" (?deflated@zlib@iostreams@boost@@3HB)
packagehandler.obj:-1: error: LNK2001: unresolved external symbol "int const boost::iostreams::zlib::default_strategy" (?default_strategy@zlib@iostreams@boost@@3HB)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "protected: __thiscall boost::iostreams::detail::zlib_base::~zlib_base(void)" (??1zlib_base@detail@iostreams@boost@@IAE@XZ) referenced in function __unwindfunclet$??0?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE@ABUzlib_params@23@@Z$0
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "protected: __thiscall boost::iostreams::detail::zlib_base::zlib_base(void)" (??0zlib_base@detail@iostreams@boost@@IAE@XZ) referenced in function "public: __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> >::zlib_decompressor_impl<class std::allocator<char> >(struct boost::iostreams::zlib_params const &)" (??0?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE@ABUzlib_params@23@@Z)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "protected: void __thiscall boost::iostreams::detail::zlib_base::reset(bool,bool)" (?reset@zlib_base@detail@iostreams@boost@@IAEX_N0@Z) referenced in function "public: __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> >::~zlib_decompressor_impl<class std::allocator<char> >(void)" (??1?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE@XZ)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "private: void __thiscall boost::iostreams::detail::zlib_base::do_init(struct boost::iostreams::zlib_params const &,bool,void * (__cdecl*)(void *,unsigned int,unsigned int),void (__cdecl*)(void *,void *),void *)" (?do_init@zlib_base@detail@iostreams@boost@@AAEXABUzlib_params@34@_NP6APAXPAXII@ZP6AX22@Z2@Z) referenced in function "protected: void __thiscall boost::iostreams::detail::zlib_base::init<class std::allocator<char> >(struct boost::iostreams::zlib_params const &,bool,struct boost::iostreams::detail::zlib_allocator<class std::allocator<char>,class std::allocator<char> > &)" (??$init@V?$allocator@D@std@@@zlib_base@detail@iostreams@boost@@IAEXABUzlib_params@23@_NAAU?$zlib_allocator@V?$allocator@D@std@@V12@@123@@Z)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall boost::iostreams::detail::gzip_footer::process(char)" (?process@gzip_footer@detail@iostreams@boost@@QAEXD@Z) referenced in function __catch$??$read@V?$linked_streambuf@DU?$char_traits@D@std@@@detail@iostreams@boost@@@?$basic_gzip_decompressor@V?$allocator@D@std@@@iostreams@boost@@QAE_JAAV?$linked_streambuf@DU?$char_traits@D@std@@@detail@12@PAD_J@Z$0
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall boost::iostreams::detail::gzip_header::process(char)" (?process@gzip_header@detail@iostreams@boost@@QAEXD@Z) referenced in function "public: __int64 __thiscall boost::iostreams::basic_gzip_decompressor<class std::allocator<char> >::read<class boost::iostreams::detail::linked_streambuf<char,struct std::char_traits<char> > >(class boost::iostreams::detail::linked_streambuf<char,struct std::char_traits<char> > &,char *,__int64)" (??$read@V?$linked_streambuf@DU?$char_traits@D@std@@@detail@iostreams@boost@@@?$basic_gzip_decompressor@V?$allocator@D@std@@@iostreams@boost@@QAE_JAAV?$linked_streambuf@DU?$char_traits@D@std@@@detail@12@PAD_J@Z)
packagehandler.obj:-1: error: LNK2001: unresolved external symbol "int const boost::iostreams::zlib::okay" (?okay@zlib@iostreams@boost@@3HB)
packagehandler.obj:-1: error: LNK2001: unresolved external symbol "int const boost::iostreams::zlib::stream_end" (?stream_end@zlib@iostreams@boost@@3HB)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "public: static void __cdecl boost::iostreams::zlib_error::check(int)" (?check@zlib_error@iostreams@boost@@SAXH@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> >::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "protected: void __thiscall boost::iostreams::detail::zlib_base::after(char const * &,char * &,bool)" (?after@zlib_base@detail@iostreams@boost@@IAEXAAPBDAAPAD_N@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> >::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "protected: int __thiscall boost::iostreams::detail::zlib_base::xinflate(int)" (?xinflate@zlib_base@detail@iostreams@boost@@IAEHH@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> >::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z)
packagehandler.obj:-1: error: LNK2001: unresolved external symbol "int const boost::iostreams::zlib::sync_flush" (?sync_flush@zlib@iostreams@boost@@3HB)
packagehandler.obj:-1: error: LNK2019: unresolved external symbol "protected: void __thiscall boost::iostreams::detail::zlib_base::before(char const * &,char const *,char * &,char *)" (?before@zlib_base@detail@iostreams@boost@@IAEXAAPBDPBDAAPADPAD@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> >::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z)
debug\EmbeddedBoardTestScriptUtility.exe:-1: error: LNK1120: 18 unresolved externals
答案 0 :(得分:0)
您应该检查Boost库目录中是否有libboost_iostreams .lib库,以及链接器项目设置中链接目录和链接库中是否正确链接。
如果你已经编译了boost并且对boost编译有疑问(它可以使用许多选项编译,不包括某些项目),你可以使用sourceforge [1]上提供的预编译二进制文件。
[1] https://sourceforge.net/projects/boost/files/boost-binaries/1.60.0/
答案 1 :(得分:0)
您需要通过启用zlib来增强性能。在配置阶段,boost将尝试找到zlib,如果成功,则在运行b2命令时应该会看到类似的内容。
在大多数* nix平台上,您需要安装zlib dev软件包。在Windows上,您需要在编译boost之前查找/构建zlib二进制文件并设置这3个环境变量。
ZLIB_BINARY ZLIB_INCLUDE ZLIB_LIBPATH
请参阅以下增强文档:
https://www.boost.org/doc/libs/1_54_0/libs/iostreams/doc/installation.html