2012-04-09 85 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 

解決了這個問題對我來說 - 這個代碼是沒有錯誤編譯成功。