boost::文件系统中的错误,这可能吗
Bug in boost::filesystem, is this possible?
当我试图编译以下代码时:
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
using namespace std;
int main()
{
boost::filesystem3::path file_path("C:\Users\Art\Desktop\ASO.sln");
boost::filesystem3::path new_path(file_path.begin(),file_path.end() - 1);
return 0;
}
我收到一个错误:
C:UsersMeboost_path......boost_148includeboost-1_48boostfilesystemv3path.hpp:163: error: no matching function for call to 'convert(const boost::filesystem3::path*, const boost::filesystem3::path*, boost::filesystem3::path::string_type&, const codecvt_type&)'
为什么?我认为boost::filesystem
中有一个错误。
您的第二行代码有一个不需要的-1
。下面是您正在调用的ctor的代码。
template <class InputIterator>
path(InputIterator begin, InputIterator end)
{
if (begin != end)
{
std::basic_string<typename std::iterator_traits<InputIterator>::value_type>
s(begin, end);
path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt());
}
}
boost::filesystem::path
的begin()
和end()
迭代器是而不是字符迭代器。它们是目录迭代器;它们对路径中的目录进行迭代。这些迭代器中的value_type
本身就是包含目录的path
。
因此,您不能像那样从另一个path
的迭代器构造path
。
相关文章:
- 获取 clang++:错误:在编译文件系统库的代码时
- C++ VS 错误:<实验/文件系统>提供 std::experimental::文件系统的标头已被Microsoft弃用,将被删除
- 将 std::文件系统头文件添加到我的程序时出现编译错误
- 来自提升的分段错误(提升:文件系统:存在)
- 针对 QNX 交叉编译后,boost 文件系统 (1.63) 失败并出现未定义的引用错误
- C++ Mingw32 创建进程() 失败,错误代码 2:系统找不到指定的文件
- 使用<实验/文件系统>和调用函数的链接器错误
- 尽管使用了boost_NO_CXX11_SCOPED_ENUMS,但boost::文件系统出现未定义的引用错误
- Simple_ls.cpp的C++Boost编译错误-未找到对Boost的引用::文件系统::路径::文件名
- 错误:在"boost::文件系统::p ath::文件名() const() + "/""中与"运算符+"不匹配
- ROS在linux下使用C++的boost::文件系统库链接错误
- Boost文件系统库中未解析的外部符号(错误LNK2019)
- 文件系统项目"Member access into incomplete type"错误
- 使用提升::文件系统的分段错误
- 尝试链接 boost::文件系统以调试 MSVC11 项目时出现链接器错误
- 常见日志文件系统 API 的 RegisterManageableLogClient() 和"access is denied"错误
- 实验::在使用-lsdc++fs选项后使用GCC6时出现文件系统链接器错误
- boost::文件系统中的错误,这可能吗
- Boost错误:Boost.文件系统V3及更高版本需要std::wstring支持
- 错误boost::文件系统没有名为string()的成员