简体   繁体   中英

QT Linker errors with boost iostreams

I am trying to compile a Qt 5.5 application using msvc2010. However whenever I try to build it I get several linker errors all relating to 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.

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].

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

You need to build boost with zlib enabeled. 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

On most *nix platforms you need to install the zlib dev package. On Windows you need find/build zlib binaries and set these 3 environment variables before compiling boost.

ZLIB_BINARY ZLIB_INCLUDE ZLIB_LIBPATH

See this boost documentation:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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