【发布时间】:2014-05-31 06:02:01
【问题描述】:
我对@987654321@ 很陌生。我尝试了最简单的程序,但它失败了,并且我无法从 GitHub 存储库中找到答案。
#include <iostream>
#include "yaml-cpp/yaml.h"
using namespace std;
int main()
{
YAML::Node config = YAML::LoadFile("sample.yaml");
return 0;
}
sample.yaml YAML 官网示例:
--- !clarkevans.com/^invoice
invoice: 34843
date : 2001-01-23
bill-to: &id001
given : Chris
family : Dumars
address:
lines: |
458 Walkman Dr.
Suite #292
city : Royal Oak
state : MI
postal : 48046
ship-to: *id001
product:
- sku : BL394D
quantity : 4
description : Basketball
price : 450.00
- sku : BL4438H
quantity : 1
description : Super Hoop
price : 2392.00
tax : 251.42
total: 4443.52
comments: >
Late afternoon is best.
Backup contact is Nancy
Billsmer @ 338-4338.
这是错误信息:
libc++abi.dylib: terminating with uncaught exception of type YAML::BadFile: yaml-cpp: error at line 0, column 0: bad file
是库构建问题还是 YAML 语法问题还是我的 API 使用问题?
我使用的是yaml-cpp 0.5.1 版。
【问题讨论】: