简体   繁体   中英

How do you install YAML-cpp for visual studio 2013?

How do you install the YAML-cpp libraries for use with visual studio 2013?

I have downloaded CMake (no idea how to use it) and the YAML source file and tried to follow the instructions on the website but have gotten stuck by step 2.

I have looked at How to install and use YAML-Cpp , but it isn't really detailed on how to do it.

I have navigated to the directory which has the downloaded YAML-cpp file in it but when i add the file to the CMake list it is red and throws out lots of errors when i try to configure it

CMake Error: Cannot open file for write: C:/Program Files (x86)/CMake/CMakeCache.txt.tmp
CMake Error: The source directory "C:/Program Files (x86)/CMake/source" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error: : System Error: No such file or directory
CMake Error: Unable to open cache file for save. C:/Program Files (x86)/CMake/CMakeCache.txt
CMake Error: : System Error: No such file or directory

what am I doing wrong?

There is a fair description of what you have to do on the project page here but more specifically this part:

How to Build yaml-cpp uses CMake to support cross-platform building. The basic steps to build are:

Download and install CMake (Resources -> Download). Note: If you don't use the provided installer for your platform, make sure that you add CMake's bin folder to your path.

  1. Navigate into the source directory, and type: mkdir build cd build
  2. Run CMake. The basic syntax is: cmake [-G generator] [-DBUILD_SHARED_LIBS=ON|OFF]

..The generator is whatever type of build system you'd like to use. To see a full list of generators on your platform, just run cmake (with no arguments). For example:

  • On Windows, you might use "Visual Studio 12 2013" to generate a Visual Studio 2013 solution.
  • On OS X, you might use "Xcode" to generate an Xcode project.

  • On a UNIX-y system, simply omit the option to generate a makefile.

yaml-cpp defaults to building a static library, but you may build a shared library by specifying -DBUILD_SHARED_LIBS=ON .

For more options on customizing the build, see the CMakeLists.txt file.

Build it!

To clean up, just remove the build directory.

so you could use it as a static library in your project with this you can can all the method like you normally would.

Alternatively you could skip all the cMake stuff and just copy all the .h and .cpp files into a folder in your project then just reference it like any other piece of code, the downside being that you have to copy and maintain the around 20-30 files that could change as people commit to the project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM