Warnings when compiling Boost libraries in C++ Builder -


i getting warnings when trying include <boost/thread.hpp> in c++ builder. every unit including it, c++ builder shows these 2 lines:

thread_heap_alloc.hpp(59): w8128 can't import function being defined thread_heap_alloc.hpp(69): w8128 can't import function being defined 

already tried things, nothing worked though.

it compiles correctly, however, it's getting on nerves. why message being shown?

the lines are:

#include <boost/config/abi_prefix.hpp>  namespace boost {     namespace detail     {         inline boost_thread_decl void* allocate_raw_heap_memory(unsigned size)         {              void* const eap_memory=detail::win32::heapalloc(detail::win32::getprocessheap(),0,size);             if(!heap_memory)             {                 throw std::bad_alloc();             }         return heap_memory;     }      inline boost_thread_decl void free_raw_heap_memory(void* heap_memory)     {         boost_verify(detail::win32::heapfree(detail::win32::getprocessheap(),0,heap_memory)!=0);     } 

where 59 { below boost_thread_decl, 69. looks boost_thread_decl not defined or mis-defined, trying follow through boost code not easy.

this boost 1.39.

add #define boost_thread_use_lib before including thread.hpp.

this tested:

#define boost_thread_use_lib extern "c" {    namespace boost    {       void tss_cleanup_implemented( void )       {          /*          function's sole purpose cause link error in cases          automatic tss cleanup not implemented boost.threads          reminder user code responsible calling necessary          functions @ appropriate times (and implementing          tss_cleanup_implemented() function eliminate linker's          missing symbol error).           if boost.threads later implements automatic tss cleanup in cases          doesn't (which plan), duplicate          symbol error warn user custom solution no          longer needed , can removed.*/       }    } } #include <boost/thread.hpp> 

then set 'link dynamic rtl' , 'link runtime packages'.

this clean build , starts thread properly.

i've written blog entry this: http://blog.marionette.ca/cross-platform-threading-for-c-builder-using-boostthread/


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -