How to install and use YAML-Cpp

拥有回忆 提交于 2019-12-13 16:30:11

问题


I want to learn YAML (and use it with C++) but i'm stuck trying to setup YAML-Cpp. Let me explain what i've done so far.

  • I downloaded the source code (version 0.5.1)
  • Installed Cmake (for Windows)
  • Installed the Boost libraries (precompiled for Visual Studio 2010)

EDIT:

  • Built the solution and the INSTALL project
  • Then i got two folders on my C drive: include and lib
  • Then i moved it to another folder on my D drive (maybe it's relevant)

For testing, i created a project in V Express and tried to compile this:

#include "yaml-cpp/yaml.h"

int main()
{
   YAML::Emitter out;
   out << "Hello, World!";

   std::cout << "Here's the output YAML:\n" << out.c_str();
   return 0;
}

The new result:

d:\development\yamlcpp 0.51\include\yaml-cpp\node\ptr.h(10): fatal error C1083: Cannot open include file: 'boost/shared_ptr.hpp': No such file or directory

Can somebody please tell me what is the right way to build and configure this library?


回答1:


It looks like you're not including the proper directory. In Visual Studio, there's an option for the "include directories" - make sure that the include directory for yaml-cpp is listed there.




回答2:


marlon, you need to download boost-cpp (http://sourceforge.net/projects/boost/files/boost/1.58.0/), compile it and ensure to "include directory" in Visual Studio.



来源:https://stackoverflow.com/questions/21250377/how-to-install-and-use-yaml-cpp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!