简体   繁体   English

带有 boost iostreams 的 QT 链接器错误

[英]QT Linker errors with boost iostreams

I am trying to compile a Qt 5.5 application using msvc2010.我正在尝试使用 msvc2010 编译 Qt 5.5 应用程序。 However whenever I try to build it I get several linker errors all relating to boost::iostreams.然而,每当我尝试构建它时,我都会收到几个与 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

You should check if libboost_iostreams .lib library is available in your Boost libraries directory and if if is correctly linked in linking directories and linked libraries in linker project settings.您应该检查 libboost_iostreams .lib 库是否在您的 Boost 库目录中可用,以及是否在链接器项目设置中的链接目录和链接库中正确链接。

If you have compiled boost and have doubts on boost compilation (it can be compiled with many options excluding some projects) you can use precompiled binaries available on sourceforge [1].如果您已经编译了 boost 并且对 boost 编译有疑问(它可以使用许多选项编译,但某些项目除外),您可以使用 sourceforge [1] 上提供的预编译二进制文件。

[1] https://sourceforge.net/projects/boost/files/boost-binaries/1.60.0/ [1] https://sourceforge.net/projects/boost/files/boost-binaries/1.60.0/

You need to build boost with zlib enabeled.您需要使用启用的 zlib 来构建提升。 During the configuration phase boost will try to locate zlib and if succesfull you should see something like this when running the b2 command.在配置阶段,boost 将尝试定位 zlib,如果成功,您应该在运行 b2 命令时看到类似的内容。

boost配置查找zlib

On most *nix platforms you need to install the zlib dev package.在大多数 *nix 平台上,您需要安装 zlib dev 包。 On Windows you need find/build zlib binaries and set these 3 environment variables before compiling boost.在 Windows 上,您需要在编译 boost 之前找到/构建 zlib 二进制文件并设置这 3 个环境变量。

ZLIB_BINARY ZLIB_INCLUDE ZLIB_LIBPATH ZLIB_BINARY ZLIB_INCLUDE ZLIB_LIBPATH

See this boost documentation:请参阅此提升文档:

https://www.boost.org/doc/libs/1_54_0/libs/iostreams/doc/installation.html https://www.boost.org/doc/libs/1_54_0/libs/iostreams/doc/installation.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM