2011/8/17 Frédéric Bron <frederic.bron@m4x.org>
I am trying to use boost 1.47 on cygwin 1.7 cross-compiling to win32
with i686-w64-mingw32-g++ (4.5.3).

This program gives me an error:

#include <boost/thread/tss.hpp>
int main() {
       boost::thread_specific_ptr<int> ts;
       return 0;
}

$ i686-w64-mingw32-g++ -o mgw-release/obj/Tests/toto.o -c -O3 -DNDEBUG
-Wall -Wextra -pipe -mthreads
-I/cygdrive/d/Softs/1.7/mgw-release/boost/include -I. Tests/toto.cc
In file included from
/cygdrive/d/Softs/1.7/mgw-release/boost/include/boost/thread/detail/thread_heap_alloc.hpp:15:0,
                from
/cygdrive/d/Softs/1.7/mgw-release/boost/include/boost/thread/tss.hpp:10,
                from Tests/toto.cc:1:
/cygdrive/d/Softs/1.7/mgw-release/boost/include/boost/thread/win32/thread_heap_alloc.hpp:59:40:
warning: inline function ‘void*
boost::detail::allocate_raw_heap_memory(unsigned int)’ declared as
dllimport: attribute ignored
/cygdrive/d/Softs/1.7/mgw-release/boost/include/boost/thread/win32/thread_heap_alloc.hpp:69:39:
warning: inline function ‘void
boost::detail::free_raw_heap_memory(void*)’ declared as  dllimport:
attribute ignored

$ i686-w64-mingw32-g++ -o mgw-release/bin/toto -O3 -DNDEBUG -Wall
-Wextra -pipe -mthreads
-I/cygdrive/d/Softs/1.7/mgw-release/boost/include
mgw-release/obj/Tests/toto.o -Wl,--enable-auto-import -static
-L/cygdrive/d/Softs/1.7/mgw-release/boost/lib -lboost_thread_win32
mgw-release/obj/Tests/toto.o:toto.cc:(.text+0x104): undefined
reference to `__imp___ZN5boost6detail12set_tss_dataEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
collect2: ld returned 1 exit status

any help would be welcome.

Try to compile with -DBOOST_THREAD_USE_LIB=1