2016-05-19 10 views
0

私はブーストライブラリを使用している初心者です。boost/algorithm/string/trim.hppでコンパイルエラー

#include<boost/version.hpp> 
#include <iostream> 

using namespace std; 

int main() { 
cout << "My first boost program with version:" <<BOOST_LIB_VERSION<< endl; 
return 0; 
} 

上記のコードは、コンパイルエラーまたは実行エラーなしで返されます。

出力: My first boost program with version:1_33_1

しかし、私は私の.cppファイル内のブースト/アルゴリズム/文字列/ trim.hppが含まれている場合、私は、コンパイルエラーに直面しています。

#include<boost/version.hpp> 
#include <boost/algorithm/string/trim.hpp>  
#include <iostream> 

using namespace std; 

int main() { 
cout << "My first boost program with version:" <<BOOST_LIB_VERSION<< endl; 
return 0; 
} 

at this point in file device_tml  line 35, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
at this point in file device_tml  line 41, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
expected ';' before 'str_end' device_tml  line 57, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
expected primary-expression before ',' token device_tml  line 57, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
expected primary-expression before ';' token device_tml  line 111, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
expected primary-expression before ')' token device_tml  line 57, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
expected primary-expression before '*' token device_tml  line 57, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
no matching function for call to 'str_end()' device_tml  line 103, external location: /usr/include/boost/range/end.hpp C/C++ Problem 
no matching function for call to 'str_end()' device_tml  line 108, external location: /usr/include/boost/range/end.hpp C/C++ Problem 
no matching function for call to 'str_end()' device_tml  line 111, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 
no matching function for call to 'str_end()' device_tml  line 113, external location: /usr/include/boost/range/end.hpp C/C++ Problem 
no matching function for call to 'str_end()' device_tml  line 98, external location: /usr/include/boost/range/end.hpp C/C++ Problem 
return-statement with no value, in function returning 'char*' device_tml  line 103, external location: /usr/include/boost/range/begin.hpp C/C++ Problem 
    return-statement with no value, in function returning 'const char*' device_tml  line 98, external location: /usr/include/boost/range/begin.hpp C/C++ Problem 
return-statement with no value, in function returning 'const wchar_t*' device_tml  line 108, external location: /usr/include/boost/range/begin.hpp C/C++ Problem 
return-statement with no value, in function returning 'wchar_t*' device_tml  line 113, external location: /usr/include/boost/range/begin.hpp C/C++ Problem 
too few arguments to function 'size_t strlen(const char*)' device_tml  line 243, external location: /usr/include/string.h C/C++ Problem 
too few arguments to function 'size_t wcslen(const wchar_t*)' device_tml  line 243, external location: /usr/include/wchar.h C/C++ Problem 
const wchar_t* boost::range_detail::str_end(const wchar_t*, const wchar_t*) device_tml  line 39, external location: /usr/include/boost/range/detail/implementation_help.hpp C/C++ Problem 

コンパイラのバージョン

gcc version 4.1.2 20080704 (Red Hat 4.1.2-52) 

コンパイラオプション

-O0 -g3 -Wall -c -fmessage-length=0 -fpic -o  
+1

これは興味深い問題のように見えますが、私たちは完全な説明を見ることができるので、あなたは、エラーメッセージのテキストではなく、スクリーンショットを挿入してください可能性があります。コンパイラのバージョンとコンパイラのフラグについても教えてください。便利であるかもしれません。 –

+2

私がドキュメントを読んでいるのであれば、boost 1.33は11歳です。現代のコンパイラと互換性がないかもしれません。もっと最近のバージョンのブーストを試しましたか? –

+1

私は現在のboost(1.61開発版)でこれを試してみましたが、w/oエラーをコンパイルしました。 –

答えて

0

Iは最初の行で上ヘッダ

#include <boost/algorithm/str‌​ing.hpp> 

を配置することによってこの問題を解決することができました。なぜそれが働いたのか分からない。

おかげ