1

I am trying to use yaml-cpp in a code but I get the following error:

yaml-cpp/0.5.1/include/yaml-cpp/node/detail/node_ref.h:47:95: erreur: use of deleted function ‘boost::shared_ptr<YAML::detail::memory_holder>::shared_ptr(const boost::shared_ptr<YAML::detail::memory_holder>&)’ void push_back(node& node, shared_memory_holder pMemory) { m_pData->push_back(node, pMemory); }

The code which leads to this error is:

#include <cstdlib>
#include <yaml-cpp/yaml.h>
int main()
{
    YAML::Emitter out;
    return EXIT_SUCCESS;
}

I have tried to use the last version of boost to overcome the problem but it does not seem to change anything. Here is the cmake command I used to install yaml-cpp:

cmake -D CMAKE_INSTALL_PREFIX=/usr/local/yaml-cpp/0.5.1/ -D Boost_NO_BOOST_CMAKE=TRUE -D BOOST_ROOT=/usr/local/boost/1.57.0 -D Boost_LIBRARY_DIRS=/usr/local/boost/1.57.0/lib/ -D Boost_NO_SYSTEM_PATHS=TRUE -D CMAKE_CXX_COMPILER=/usr/local/gcc/4.8.2/bin/g++ ..
make
make install

Can you help me, please?

EDIT: the problem disappears when I remove -std=c++11 flag from my compilation command line.

EDIT: to solve the problem, you have to put the path to the include directory of your boost installation in your compilation command line. See comments below the answer of user744629.

1 Answer 1

1

Edit

As the comments says, yaml-cpp was correctly built and installed, but compiling the executable required -I flag to include the Boost headers yaml-cpp was built with, otherwise the too old Boost headers in system directories were used.

Original answer

Here is the command line I use to build yaml-cpp with Boost installed in a non standard location:

cmake \
    -DCMAKE_INSTALL_PREFIX=$PREFIX \
    -DBoost_INCLUDE_DIR=$PREFIX/boost_1_55_0 \
    -DBUILD_SHARED_LIBS=ON \
    ..

See the full conda recipe.

Hope it helps.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much for your help but I still have the same problem with your cmake command line.
When compiling your main.cxx, did put the -I/usr/local/boost/1.57.0/include flag?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.