-1

Newbie to windows. I need to use yaml-cpp library in a project, but I can't seem to compile it in windows. I tried everything (everhthing!) I could find but no place have the full answer, just tips for the process. but those tips don't help so much. I did create shared lib in Ubuntu but can't create dll in windows. can someone give the full explanation to get dll from source code? (I also be grateful for explanation of how use the dll with it's includes).

Working with visual studio 2015.

Izik
  • 746
  • 1
  • 9
  • 25
  • Did you use CMake? Looking at the CMakeLists.txt there will be an option in cmake-gui to build shared libraries. With that said on Visual Studio you will most likely still need the `.lib` file which in this case is an import library not a static library. – drescherjm Apr 08 '18 at 14:21
  • In Ubuntu I did all the steps and it's works OK. In Windows I also did all what I think need to be done, including CMake but it still not working, – Izik Apr 10 '18 at 07:48
  • I expect that you will have to show what part is not working to get help. It is unlikely anyone will download `yaml-cpp` and try this on their own to help you out. You are more likely to get help from users who know `CMake` and recognize an error you are making in your steps. – drescherjm Apr 10 '18 at 15:45
  • @drescherjm I asked for full explanation for the compilation process to get library, rather then get another answer why something is not working. There are no good documentations to explain this from beginning to end. – Izik Apr 11 '18 at 17:39

1 Answers1

0

So finally I got it. for linux users - use cmake. for windows users - you can but I really don't recommend it unless you need cross compiling. Use visual studio: (explained for VS 2017)

First create new project with existing code. The folder you pick should be "src" (in case of cpp-yaml). When creating the project you need to choose type of project (exe, dynamic or static library), so choose dynamic library to create .dll or static to create .lib.

After creating your project go to your project properties, go to c/c++ tab --> General --> "additional include directories", and add your path to the headers folder ("include"). Do not add "cpp-yaml" inside the include folder, only "include". Now build. In the console you can see where the library was created.

To use it, in case you made static library 4 things need to be done:

  1. add to your project "#include cpp-yaml/yaml.h" in properties:
  2. in tab "c/c++" --> General --> "additional include directories", add the include folder path. (as before)
  3. in tab "Linker" -->Input, add to the "Additional dependencies" your lib name (followed by semi-colon)
  4. in tab "Linker" --> General, add to "additional library directories" the path to your lib.
Izik
  • 746
  • 1
  • 9
  • 25