2016-05-19 76 views
0

我初学者使用boost库。用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

如果我正在阅读文档右键提高1.33是11岁:它可能只是与现代编译器不兼容。你有没有尝试过更新版本的提升? –

+1

我只是用当前的增强版(1.61开发版)试过这个版本,并且它编译了W/O错误。 –

回答

0

我能够通过将头

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

之上在第一线来解决这个问题。我不确定它工作的原因。

感谢