Minimal boost.org includes to use just one sub-library

吃可爱长大的小学妹 提交于 2021-02-07 13:18:36

问题


I'd like to use the boost smart_ptr library. I don't want any of the other libraries because I'm trying to keep my project small.

When I added just the smart_ptr library I got complaints that the config.hpp header couldn't be found. I added that file then my compiler said it couldn't find the assert.hpp header. I gave up after that and just included the entire boost library.

Is there a minimal set of boost libraries that must be used if I want to use one of the sub-libraries (e.g., smart_ptr)?

The #include statement I use is:

#include <boost/smart_ptr/shared_ptr.hpp>

The directory structure I have looks like this

MyProject/
    main.cpp
    MyLib/
         . . . My library code is here. . .
    boost/
        boost/
            smart_ptr/
            smart_ptr.hpp
            . . . All other boost sub-libraries are also here. . .

回答1:


The utility bcp can be used to extract a boost header and its dependencies.

Extracting single libraries can be a bit complicated because the dependency structure is not documented and changes between releases. bcp is the way to go.

You can find it here.



来源:https://stackoverflow.com/questions/22973477/minimal-boost-org-includes-to-use-just-one-sub-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!