2012-04-09 89 views
0

嗨我想使用gnuplot-iostream,在那一刻我只是想让代码here工作。当我尝试combile我得到的错误在连接俗话说: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 

注意:我已经安装了升压和以前编译使用iostream的程序。 任何帮助大量赞赏。谢谢

回答

5

排除显而易见的...你在编译g++ -lboost_iostreams?如果你可以分享一些关于编译器和链接器被调用的信息,那么它将更容易回答你的问题。

+0

我不确定,我在蚀食。当我查看gcc C++编译器的设置时,它会在所有选项框中声明命令g ++ -I/usr/include/boost -O0 -g3 -Wall -c -fmessage-length = 0。 Binary Parser是Elf,错误Parsers CDT,工具链是Linux GCC,当前的构建器是GNU make Builder。如果您需要更多信息,请询问,最好让我知道在哪里可以找到它。对不起,如果有些东西是多余的。我喜欢编程,但在编译/编译时并不是最模糊的。 – wookie1 2012-04-09 16:47:13

+0

我对eclipse并不熟悉,但我知道'-I/usr/include/boost'只会告诉编译器在哪里找到boost头文件。它没有告诉链接器在哪里可以找到boost库。看看有没有办法让Eclipse在编译器参数列表中添加'-lboost_iostreams'。 – 2012-04-09 17:06:35

+0

辉煌,解决方法是将boost_iostream添加到properties-> c/C++ Build-> Settings-> GCC C++ Linker-> Libraries(-l)。 – wookie1 2012-04-09 17:27:07

0

当试图在gnuplot-iostream库中使用g ++时遇到确切的问题。

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

解决了这个问题对我来说 - 这个代码是没有错误编译成功。