ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

c – 提升iostreams编译错误

2019-07-24 18:06:31  阅读:699  来源: 互联网

标签:c compilation gcc boost iostream


这是我的编译行:

g++ -std=c++11 -Wall -Wextra -g -lboost_iostreams cppfile.cpp -o bin

但是我有以下错误:

/tmp/cclste3G.o: In function `trie::write_on_disk(char*)':
undefined reference to `boost::iostreams::zlib::default_strategy'
undefined reference to `boost::iostreams::zlib::deflated'
undefined reference to `boost::iostreams::zlib::default_compression'
/tmp/cclste3G.o: In function `boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, int)':
/usr/include/boost/iostreams/filter/gzip.hpp:671: undefined reference to `boost::iostreams::zlib::best_compression'
/usr/include/boost/iostreams/filter/gzip.hpp:671: undefined reference to `boost::iostreams::zlib::best_speed'
/tmp/cclste3G.o: In function `boost::iostreams::detail::zlib_compressor_impl<std::allocator<char> >::zlib_compressor_impl(boost::iostreams::zlib_params const&)':
/usr/include/boost/iostreams/filter/zlib.hpp:338: undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()'
/usr/include/boost/iostreams/filter/zlib.hpp:338: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
/tmp/cclste3G.o: In function `boost::iostreams::detail::zlib_compressor_impl<std::allocator<char> >::~zlib_compressor_impl()':
/usr/include/boost/iostreams/filter/zlib.hpp:343: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/include/boost/iostreams/filter/zlib.hpp:343: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
/tmp/cclste3G.o: In function `void boost::iostreams::detail::zlib_base::init<std::allocator<char> >(boost::iostreams::zlib_params const&, bool, boost::iostreams::detail::zlib_allocator<std::allocator<char>, boost::iostreams::detail::zlib_allocator_traits<std::allocator<char> >::type>&)':
/usr/include/boost/iostreams/filter/zlib.hpp:185: undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)'
/tmp/cclste3G.o: In function `boost::iostreams::detail::zlib_compressor_impl<std::allocator<char> >::filter(char const*&, char const*, char*&, char*, bool)':
/usr/include/boost/iostreams/filter/zlib.hpp:350: undefined reference to `boost::iostreams::detail::zlib_base::before(char const*&, char const*, char*&, char*)'
/usr/include/boost/iostreams/filter/zlib.hpp:351: undefined reference to `boost::iostreams::zlib::finish'
/usr/include/boost/iostreams/filter/zlib.hpp:351: undefined reference to `boost::iostreams::zlib::no_flush'
/usr/include/boost/iostreams/filter/zlib.hpp:351: undefined reference to `boost::iostreams::detail::zlib_base::xdeflate(int)'
/usr/include/boost/iostreams/filter/zlib.hpp:352: undefined reference to `boost::iostreams::detail::zlib_base::after(char const*&, char*&, bool)'
/usr/include/boost/iostreams/filter/zlib.hpp:353: undefined reference to `boost::iostreams::zlib_error::check(int)'
/usr/include/boost/iostreams/filter/zlib.hpp:354: undefined reference to `boost::iostreams::zlib::stream_end'
/tmp/cclste3G.o: In function `boost::iostreams::detail::zlib_compressor_impl<std::allocator<char> >::close()':
/usr/include/boost/iostreams/filter/zlib.hpp:358: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'

我使用-lboost_iostreams所以我不会低估为什么我有这个错误

问候

解决方法:

您可以通过在cppfile.cpp之后放置链接器标志-lboost_iostreams来解决此问题.订单很重要.

标签:c,compilation,gcc,boost,iostream
来源: https://codeday.me/bug/20190724/1524780.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有