gpt4 book ai didi

c++ - boost/algorithm/string/trim.hpp 编译错误

转载 作者:行者123 更新时间:2023-11-28 05:40:03 28 4
gpt4 key购买 nike

我是使用 boost 库的初学者。

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

using namespace std;

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

以上代码返回时没有编译或执行错误。

输出: 我的第一个 boost 程序版本:1_33_1

但是当我在我的 .cpp 文件中包含 boost/algorithm/string/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     

最佳答案

我可以通过放置标题来解决这个问题

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

在第一行的顶部。我不确定它起作用的原因。

谢谢

关于c++ - boost/algorithm/string/trim.hpp 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37313643/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com