jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
5.16k stars 1.86k forks source link

Unclear includes (info for beginners) #1078

Open CamelCaseCam opened 2 years ago

CamelCaseCam commented 2 years ago

I didn't understand what to include to follow the tutorial, so I figured I'd leave some instructions here. The only file (as far as I know) that you have to include is "yaml-cpp/yaml.h". If you're using a static library, you'll need to define YAML_CPP_STATIC_DEFINE. I hope this helps someone.

YokoAC commented 2 years ago

Where do you need this "YAML_CPP_STATIC_DEFINE"? Actually, I tried building a static library (which was successful) and the library is linked in the right way as well, but I still get linker errors if I am using "YAML::LoadFile".

D3r3k23 commented 2 years ago

I believe I had the same problem with YAML::LoadFile, I fixed it by defining YAML_CPP_STATIC_DEFINE in my whole project in CMake.

YokoAC commented 2 years ago

Actually, my problem was that I build the library for 32bit and included it in a project which is using 64bit. I did not need to define anything, after building the library for 64bit.