Ric*_*ead 4 c++ multithreading boost 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)
]`
Run Code Online (Sandbox Code Playgroud)
这只是通过包含标题,它似乎与我的代码没有任何关系,但我看不出该怎么办,有人可以帮忙吗?
如果您使用的是MSVC向导,请确保包含boost标头
#include <boost/thread/thread.hpp>
Run Code Online (Sandbox Code Playgroud)
在生成的块之前
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
Run Code Online (Sandbox Code Playgroud)