yaml-cpp 的编译器错误 - 未定义对 `YAML::detail::node_data::convert_to_map` 的引用
问题描述
这是完整的日志:
我要编译的代码很简单
我使用的 YAML 是来自 http://www.yaml.org/start 的示例.html
The YAML I'm using is the example from http://www.yaml.org/start.html
如果我只是尝试加载 YAML,它可以正常加载.但是,如果我尝试访问任何数据,我会得到同样的错误.所以这不是链接问题.
If I just try to load the YAML, it loads fine. But if I try to access any data I get the same error. So it's not a linking problem.
我可以做类似 cout <<test
和 cout <<test.type()
等函数.我认为问题在于使用基于字符串的映射来访问内部节点.
I can do things like cout << test
and cout << test.type()
and other functions. I think the problem is in using a string based map for accessing internal nodes.
推荐答案
您似乎没有正确链接 yaml-cpp
库.编译时添加参数-lyaml-cpp
.例如:
It seems that you are not properly linking the yaml-cpp
library. Add the argument -lyaml-cpp
when compiling. For example:
<小时>
编辑
另一种选择是将此 cmake 包含到您的 CMakeLists.txt 中:
EDIT
Another option is to include this cmake to your CMakeLists.txt:
这篇关于yaml-cpp 的编译器错误 - 未定义对 `YAML::detail::node_data::convert_to_map` 的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!