本文介绍了提高文件系统路径为追加字符数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在code的片段是:
boost::filesystem::path petscConfigurationPath;
petscConfigurationPath.append("FluidPetsc/Basic.conf");
这将导致以下错误与提升1.54:
It results in the following errors with boost 1.54:
error: no matching function for call to ‘boost::filesystem::path::append(const char [22])’
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 2 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 2 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 3 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
102:78: error: no matching function for call to ‘boost::filesystem::path::append(const char [40])’
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
102:78: note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 2 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 2 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 3 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
104:69: error: no matching function for call to ‘boost::filesystem::path::append(const char [28])’
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
104:69: note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
104:69: note: candidate expects 2 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
104:69: note: candidate expects 2 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
69: note: candidate expects 3 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
在使用boost 1.57有方法
When using boost 1.57 there are methods
path& append(const value_type* ptr);
template <class Source>
path& append(Source const& source);
凡在1.54版本确实存在这些方法?
Where does these methods exist in version 1.54?
推荐答案
的标题(和文档)指出,追加
要求 codeCVT
参数那时(告诉追加功能转换如何字符集要完成)。
The headers (and the documentation) indicate that append
required a codecvt
parameter back then (to tell the append function how characterset conversions are to be done).
这适用于1.54:
#include <boost/filesystem.hpp>
int main() {
boost::filesystem::path petscConfigurationPath;
petscConfigurationPath.append("FluidPetsc/Basic.conf", boost::filesystem::path::codecvt());
}
这篇关于提高文件系统路径为追加字符数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!