[英]Compilation error with boost::property_tree::xml_writer_settings
為了使用boost :: property_tree打印我的XML輸出,我編寫了以下代碼:
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
int main()
{
std::string filename = "test.xml";
boost::property_tree::ptree pt;
pt.put("some.path.value", "hello");
boost::property_tree::xml_writer_settings<char> settings('\t', 1);
write_xml(filename, pt, settings);
}
不幸的是我有這個錯誤,我找不到任何有關它的信息:
/usr/local/include/boost/property_tree/detail/xml_parser_writer_settings.hpp:38:19: error: type 'char' cannot be used prior to '::' because it has no members
typedef typename Str::value_type Ch;
^
任何的想法?
我會使用輔助函數
std::ofstream file("test.xml");
boost::property_tree::ptree pt;
pt.put("some.value", "test");
boost::property_tree::write_xml(
file, pt,
boost::property_tree::xml_writer_make_settings<std::string>('\t', 1));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.