GNuplot-iostream未链接到Boost

gnuplot-iostream not linking to boost

本文关键字:Boost 链接 GNuplot-iostream      更新时间:2023-10-16
嗨,我

正在尝试使用 gnuplot-iostream,目前我只是想让这里的代码正常工作。当我尝试组合时,链接器中出现错误,说:

In function `stream<int, boost::iostreams::file_descriptor_flags>':
/usr/include/boost/iostreams/stream.hpp:130: undefined reference to `boost::iostreams::file_descriptor_sink::file_descriptor_sink(int, boost::iostreams::file_descriptor_flags)'
In function `boost::iostreams::file_descriptor_sink boost::iostreams::detail::wrap<boost::iostreams::file_descriptor_sink>(boost::iostreams::file_descriptor_sink const&, boost::disable_if<boost::iostreams::is_std_io<boost::iostreams::file_descriptor_sink>, void>::type*)':
/usr/include/boost/iostreams/detail/wrap_unwrap.hpp:53: undefined reference to `boost::iostreams::file_descriptor_sink::file_descriptor_sink(boost::iostreams::file_descriptor_sink const&)'
In function `concept_adapter':
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:67: undefined reference to `boost::iostreams::file_descriptor_sink::file_descriptor_sink(boost::iostreams::file_descriptor_sink const&)'
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:38: undefined reference to `boost::iostreams::file_descriptor_sink::file_descriptor_sink(boost::iostreams::file_descriptor_sink const&)'
In function `long boost::iostreams::detail::write_device_impl<boost::iostreams::output>::write<boost::iostreams::file_descriptor_sink>(boost::iostreams::file_descriptor_sink&, boost::iostreams::char_type_of<boost::iostreams::file_descriptor_sink>::type const*, long)':
/usr/include/boost/iostreams/write.hpp:121: undefined reference to `boost::iostreams::file_descriptor::write(char const*, long)'
In function `void boost::iostreams::detail::close_impl<boost::iostreams::closable_tag>::close<boost::iostreams::file_descriptor_sink>(boost::iostreams::file_descriptor_sink&, std::_Ios_Openmode)':
/usr/include/boost/iostreams/close.hpp:224: undefined reference to `boost::iostreams::file_descriptor::close()'
In function `std::fpos<__mbstate_t> boost::iostreams::detail::seek_device_impl<boost::iostreams::any_tag>::seek<boost::iostreams::file_descriptor_sink>(boost::iostreams::file_descriptor_sink&, long, std::_Ios_Seekdir, std::_Ios_Openmode)':
/usr/include/boost/iostreams/seek.hpp:137: undefined reference to `boost::iostreams::file_descriptor::seek(long, std::_Ios_Seekdir)'
collect2: ld returned 1 exit status

注意 我已经安装了 boost,并且以前编译了使用 iostream 的程序。任何帮助都非常感谢。谢谢

排除显而易见的...你在用g++ -lboost_iostreams编译吗?如果您可以共享有关如何调用编译器和链接器的一些信息,则可以更轻松地回答您的问题。

尝试将

g++ 与 gnuplot-iostream 库一起使用时遇到确切的问题。

g++ prog.cpp -L/usr/lib -lboost_filesystem -lboost_system -lboost_iostreams

为我解决了问题 - 代码已成功编译,没有错误。