Boost.Pool documentation氏は述べている(強調鉱山):- リンカエラー
#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;
}
私が得た:
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!
しかし、私はVS2010 SP1において、このようなコードをコンパイルしようとすると、リンカエラー:
error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_49.lib'
Boost.Poolのドキュメントは間違っていますか? 私はここで何が欠けていますか? Boost.Poolはどのように使用できますか?
'ブースト:: singleton_pool'は'ミューテックスを使用して'type:' boost :: thread'ライブラリにありますので、libboost _糸。 – nabulke
あなたがboost \ pool \ detail \ mutex.hppを見ると、プールlibが独自のmutexを定義し、boost :: thread libを参照していないようです。 – Marius
@MariusBucur:私の答えを確認するためにもう一度チェックします。 – nabulke