Could you try commenting so that #define BOOST_INTERLOCKED_IMPORT __declspec(dllimport) ?
So I forced that:
#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
I rebuilt boost with the following commands:
CC=x86_64-w64-mingw32-gcc\
CXX=x86_64-w64-mingw32-g++\
./bootstrap.sh --without-icu --prefix=build --with-toolset=gcc
echo "using gcc : : x86_64-w64-mingw32-g++ :
<compileflags>-DBOOST_THREAD_USE_LIB ;" > user-config.jam
mkdir build
./b2 -d2 -j8 --layout=system --user-config=user-config.jam
--without-mpi --without-python\
link=static\
threading=multi\
runtime-link=shared\
address-model=64\
instruction-set=nocona\
target-os=windows\
threadapi=win32\
variant=release\
install > build/build.log 2>&1
but still got the following error:
x86_64-w64-mingw32-g++ -o mgw64-release/obj/Tests/xuxu2.o -c -O3
-DNDEBUG -DWINDOWS -std=c++11 -Wall -Wextra -pipe -ffloat-store
-I/home/fred/boost-1.54.0/include -DBOOST_DISABLE_ASSERTS
-DBOOST_FILESYSTEM_VERSION=3 -DBOOST_FILESYSTEM_NO_DEPRECATED
-DBOOST_THREAD_USE_LIB -I. Tests/xuxu2.cc
x86_64-w64-mingw32-g++ -o mgw64-release/bin/xuxu2.exe
mgw64-release/obj/Tests/xuxu2.o -Wl,--enable-auto-import -static
-L/home/fred/boost-1.54.0/lib -lboost_thread-mt -lboost_system-mt
-mthreads
mgw64-release/obj/Tests/xuxu2.o:xuxu2.cc:(.text$_ZN5boost6threadD1Ev[_ZN5boost6threadD1Ev]+0x1a):
undefined reference to `InterlockedDecrement'
mgw64-release/obj/Tests/xuxu2.o:xuxu2.cc:(.text.startup+0xf6):
undefined reference to `InterlockedIncrement'
/usr/lib64/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld:
mgw64-release/obj/Tests/xuxu2.o: bad reloc address 0xf6 in section
`.text.startup'
collect2: error: ld returned 1 exit status
I have also made a minimal example so that anybody can test:
#include <iostream>
#include