2012-04-09 8 views
0

こんにちは私はちょうどコードhereを手に入れようとしていますが、gnuplot-iostreamを使用しようとしています。私は私が言って、リンカでエラーが出る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にあります。バイナリパーサはエルフ、エラーパーサはCDT、ツールチェーンはLinux GCC、現在のビルダーはGNU make Builderです。より多くの情報が必要な場合は、私にそれを見つける場所を教えてください。申し訳ありませんが、いくつかのものが不必要な場合。私はプログラミングが好きですが、ビルドやコンパイルには面倒なことはありません。 – wookie1

+0

私はeclipseに慣れていませんが、 '-I/usr/include/boost'は、boostヘッダを見つける場所だけをコンパイラに伝えます。これは、リンカにブーストライブラリを見つける場所を教えてくれません。 eclipseにコンパイラ引数のリストに '-lboost_iostreams'を追加する方法があるかどうかを見てください。 –

+0

Brilliant、boost_iostreamをプロパティ - > c/C++のBuild-> Settings-> GCC C++ Linker-> Libraries(-l)に追加して解決しました。 – wookie1

0

gnuplot-iostreamライブラリでg ++を使用しようとすると、正確な問題が発生します。

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

私の問題を解決しました。コードはエラーなく正常にコンパイルされました。

関連する問題