开发者

boost::thread compilation error in Visual Studio 2010

I'm trying ot use boost for the first time in a long while and开发者_运维知识库 when I include the boost/thread.hpp header I get a compilation error inside boost itself:

    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)
    ]`

This happens just by including the header, it doesn't seem to have anything to do with my code, but I can't see what to do about it, can anyone help?


If you're using the MSVC wizard, make sure to include the boost header

#include <boost/thread/thread.hpp>

before the generated block

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


It's possible you #included some other package that has a #define of 'new', which then breaks what Boost is trying to do with placement new. To see the code after pre-processing, compile with /P or /E and then search for this line in the output and see if it looks different.


Yes, I known the problem. You can find something interest from http://connect.microsoft.com/VisualStudio/feedback/details/683483/mfc-c-fails-to-compile-use-of-codecvt-utf8-in-debug-configuration

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜