The Boost.Pool documentation says that (emphasis mine):
The Boost Pool library is a header-only library. That means there is
no .lib, .dll, or .so to build; just add the Boost directory to your
compiler’s include file path, and you should be good to go!
But when I try to compile code like this in VS2010 SP1:
#include <string>
#include <vector>
#include <boost\pool\pool_alloc.hpp>
int main()
{
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>,
boost::pool_allocator<wchar_t>> PoolString;
std::vector<PoolString> vec;
for (int i = 0; i < 100; i++)
{
PoolString s(L"Some test string. ABCDEF.");
vec.push_back(s);
}
// Release pool memory
boost::singleton_pool<boost::pool_allocator_tag, sizeof(wchar_t)>::release_memory();
return 0;
}
I got a linker error:
error LNK1104: cannot open file
‘libboost_thread-vc100-mt-gd-1_49.lib’
Is Boost.Pool documentation incorrect?
What am I missing here?
How can I use Boost.Pool?
The
boost::singleton_poolis using a default mutex implementation that is located inboost::thread, which is not header only.See the singleton_pool header quoted below for information on how to remove the dependency: