Question

I'm using Qt creator and the yaml-cpp library. I placed yaml-cpp under my source code directory and added it to the Qt project's include path like so:

INCLUDEPATH += Crypto \
    Yaml

QMAKE_CXXFLAGS += -std=gnu++0x
DEFINES += __GXX_EXPERIMENTAL_CXX0X__

As you can see, I also told it to use C++ 11 because that is a requirement of this library. However, I get this error on compiling my project (this is the only error):

../ProjectName/Yaml/yaml-cpp/node/ptr.h:11:10: fatal error: 'boost/shared_ptr.hpp' file not found
#include <boost/shared_ptr.hpp>
         ^

I also tried, at the advice of some online resources, to replace it with #include <memory>, but this does not work. When I try this, it still cannot find shared_ptr.

I probably could compile the library and link Qt creator to it, but I would have to do this on every platform I use and on every machine that every project developer uses. It seems like a more elegant solution to put the source code inside my GitHub directory and compile it along with the project to minimize the overhead of someone compiling the project on their machine, particularly since this is an open source project.

Here is the source code of Yaml-Cpp's file in question:

#include "yaml-cpp/dll.h"
#include <boost/shared_ptr.hpp>

namespace YAML
{
namespace detail {
    class node;
    class node_ref;
    class node_data;
    class memory;
    class memory_holder;

    typedef boost::shared_ptr<node> shared_node;
    typedef boost::shared_ptr<node_ref> shared_node_ref;
    typedef boost::shared_ptr<node_data> shared_node_data;
    typedef boost::shared_ptr<memory_holder> shared_memory_holder;
    typedef boost::shared_ptr<memory> shared_memory;
}
}
Was it helpful?

Solution

It seems that you do not have boost installed. You would need to amend that first.

However, you could urge the yaml-cop developers to use the recent C++ standard more and more when their software is built using C++11 or later. C++11 is not a new thing anymore. It should be utilized as much as possible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top