[英]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: 我在很长一段时间内第一次尝试使用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)
]`
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 如果您使用的是MSVC向导,请确保包含boost标头
#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. 你可能会#included其他包含#define为'new'的包,然后它会破坏Boost尝试使用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. 要在预处理后查看代码,请使用/ P或/ E进行编译,然后在输出中搜索此行,看它是否看起来不同。
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 您可以从http://connect.microsoft.com/VisualStudio/feedback/details/683483/mfc-c-fails-to-compile-use-of-codecvt-utf8-in-debug-configuration中找到您感兴趣的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.