![](/img/trans.png)
[英]Visual Studio 2010 linker error when using boost::thread
[英]boost::thread compilation error in Visual Studio 2010
我在很長一段時間內第一次嘗試使用boost,當我包含boost / thread.hpp標頭時,我在boost本身內部出現了編譯錯誤:
c:\myproj\boost_1_46_0\boost\thread\win32\thread_heap_alloc.hpp(97): error C2061: syntax error : identifier 'heap_memory
c:\myproj\boost_1_46_0\boost\thread\detail\thread.hpp(134) : see reference to function template instantiation 'T *boost::detail::heap_new<boost::detail::thread_data<F>,void(__cdecl *)(void)>(A1 &&)' being compiled
with
[
T=boost::detail::thread_data<void (__cdecl *)(void)>,
F=void (__cdecl *)(void),
A1=void (__cdecl *)(void)
]`
這只是通過包含標題,它似乎與我的代碼沒有任何關系,但我看不出該怎么辦,有人可以幫忙嗎?
如果您使用的是MSVC向導,請確保包含boost標頭
#include <boost/thread/thread.hpp>
在生成的塊之前
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
你可能會#included其他包含#define為'new'的包,然后它會破壞Boost嘗試使用new的方法。 要在預處理后查看代碼,請使用/ P或/ E進行編譯,然后在輸出中搜索此行,看它是否看起來不同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.