I need to run some code which involves yaml-cpp and cvode libraries in code blocks. I have tried to install the libraries and link to the compiler (I think that,s what I did) but it doesn't seem to work. I have also tried including the library in the directory and opening using:
#include "yaml-cpp/yaml.h"
But I keep getting errors that there is no such file in directory. I am also having to change the directory in all the h files and I feel like this is not what I should be doing. However if I leave it as
#include <yaml-cpp/yaml.h>
I get the same error.
Can someone please walk me through exactly how I can get the library to work?
I have tried building it with cmake which didn't show any error messages and I have the files built in their own folder on my computer.
I have no clue on how to fix this issue.
Thank you
Edit:
(I am on windows using a gcc compiler)
So the problem is that the library can't be found.
Does the library need to be in the same directory or can I link it in its own folder?
Once that is done should I include the library in angle brackets <> or quotation marks ""?
Step 1: you need to compile the yaml-cpp library.
After compilation, using cmake, (in the yaml-cpp/build folder) you will find the files:
libyaml-cpp.dll
and libyaml-cpp.dll.a
.
Step 2: Create a new project in CodeBlocks.
Step 3: From Project menu go to Build options and set C++11 language version or higher.
Step 4: Now you have to set the paths for the header files and for the linking of the library
Step 5: copy file libyaml-cpp.dll
to your project folder containing your *.cbp file (Codeblocks Project file).
Step 6: copy the same dll to bin\Debug
and bin\Release
directories.
Step 7: Now, in your sources, you can write #include <yaml-cpp/yaml.h>
because you told to CodeBlocks where to find the library files.
That's all.