You are here:

C++/Building boost libraries for 64-bit windows targets


Hi Ralph.

You mentioned in your answer to another question that you have configured the boost libraries to build on Windows XP Professional x64 Edition for 32-bit and 64-bit targets.
Can you please share your build configuration?

Best regards,

In theory yes. However I remember the process was painful - especially as this was my first time installing and building Boost, and I did this some time ago now. So thank you for asking as I have been meaning to better track my changes for a while and this question has forced me to do so.

I had intended to submit my changes to Boost but was put off by the requested procedure to do so (specifically which patch utility do they use, as MS Windows systems do not have a native patch utility?). I kept intending to have another go but never got around to it. If you are familiar with this procedure then I would appreciate some help.

I only built the boost libraries using the MSVC++ 8 (2005) compiler for 32-bit x86 and 64-bit AMD x64 using the native AMD x64 VC++ compiler running under Windows XP Professional x64 Edition. Specifically I did not use the x86/x64 cross compiler. Note that there is no support in Boost for IA64 architecture builds as far as I could tell. I also only modified v1 jam build files.

I am using Boost version 1.33.1 (i.e. I have a boost_1_33_1 directory).

I assume you know how to set up a VC8 command line session for and x64 build (e.g. by running the vcvarsall.bat file found in the MS Visual Studio 2005 installation tree, with a parameter of amd64 or x64, or selecting the Start > Programs > Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005 x64 Win64 Command Prompt Start menu item).

I ended up having to do the following:

- Modifying some of the Boost build files.
- Modifying one of the Boost thread library source files to build for Win64.

The build files I modified were in the <boost-root>\tools\build\v1 directory.

In the file msvc-tools.jam I modified the linker command line around line 158, in the:

actions together vc-Link

section to reverse the order in which "$(LIBPATH)" and "$(STDLIBPATH)" are mentioned. In my version "$(STDLIBPATH)" is the argument to the first /LIBPATH option:


(the above is all _one_ line but may well have been split when posting through AllExperts). I do not remember if this was just the result of my playing around or if this is in fact necessary - sorry!

In the file vc-8_0-amd64-tools.jam I appended the following four lines:

LIBPATH = $(MSVCDir)$(SLASH)PlatformSDK$(SLASH)lib$(SLASH)amd64 ;
FINDLIBS = Kernel32 ;
flags vc-8_0 C++FLAGS : /Wp64 ;

Modifying these two files should allow you to build a native AMD x64 build of the Boost libraries using MSVC++ 8 in amd64 configuration. As I mentioned above I did not attempt to build an x64 version of Boost using the VC8 x86/x64 cross compiler so did not use, look at or modify the vc-8_0-x86_amd64-tools.jam file.

The next problem you will encounter is that the Boost thread library does not build. This is due to changes to the platform SDK between Win32 and Win64, specifically that Win64 does _not_ support InterlockedCompareExchange as a function exported from kernel32, and used in the Boost thread library once.cpp source file. However, the MSVC++ 8 compiler does support this operation as an intrinsic function for both Win32 and Win64.

In the file once.cpp, in the directory <boost-root>\libs\thread\src, I made the following changes:

After the line:


I added:

# if BOOST_MSVC >= 1400
#  include <intrin.h>
#  pragma intrinsic(_InterlockedCompareExchange)

namespace {

inline LONG compare_exchange(volatile LPLONG dest, LONG exch, LONG cmp)
   return _InterlockedCompareExchange(dest, exch, cmp);


# else

(note: for brevity I have removed an explanatory comment)

Then _before_ the line:

#endif // defined(BOOST_HAS_WINTHREADS)

I added:

# endif // BOOST_MSVC >= 1400

I do not know if any other compilers support Win64 on the x64 edition of Windows XP, and are supported by Boost, but my fix is very compiler specific.

As far as I can tell these are the only files I modified.

Hope these changes help you out.  


All Answers

Answers by Expert:

Ask Experts


Ralph McArdell


I am a software developer with more than 15 years C++ experience and over 25 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.


My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at


©2017 All rights reserved.

[an error occurred while processing this directive]