Boost :: thread compilation error in Visual Studio 2010

I try to use boost boost for the first time in a long time, and when I turn on 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 only happens by including the header, it looks like it has nothing to do with my code, but I can’t figure out what to do with it, can anyone help?

+4
source share
3 answers

If you are using the MSVC wizard, be sure to include the boost header.

 #include <boost/thread/thread.hpp> 

to generated block

 #ifdef _DEBUG #define new DEBUG_NEW #endif 
+5
source

Perhaps your CAC has some other C # define 'new' package included, which then breaks down what Boost is trying to do with the new placement. To see the code after preprocessing, compile with / P or / E, then search for this line in the output and see if it looks different.

+3
source

Source: https://habr.com/ru/post/1341699/


All Articles