Update: More recent versions of Boost (1.39.0 and later) have a simpler build process, which I've written about here.
Steps to build the non-header-only Boost libraries on Windows, such as
Boost.Regex, using Microsoft Visual Studio:
Download the latest version of Boost and extract it to some location, say,
D:\Boost\, making sure to maintain the directory structure
Download the latest version of Boost Jam (you want the ntx86 binaries) and extract it to some location (probably the same as above), again making sure to maintain the directory structure
Your directory structure should now consist of
Make sure you have lots of hard drive space (at least 5GB)
In a command prompt, navigate to your Boost library folder (
D:\Boost\boost_1_38_0\) and then use this command (read further down if you want details about what these arguments are doing):
> ..\boost-jam-3.1.17-1-ntx86\bjam.exe --toolset=msvc --build-type=complete stage
If you have a dual/quad/many-core processor or can otherwise take advantage of parallel jobs, also add the
Nis the number of jobs to run at a time (e.g.
bjam.exe -j4 --toolset=msvc).
And wait. This will take a very long time.
After it completes you will have a
D:\Boost\boost_1_38_0\stage\) which will contain a
libsubdirectory, containing the compiled libraries. You may move these anywhere you wish.
You will also have a
bin.v2subdirectory which was used for temporary files. You may delete this folder to reclaim some hard drive space.
--toolset=msvc : tells Boost Jam to compile with Microsoft Visual Studio.
--build-type=complete : notes that you want every possible combination built (Debug/Release, Multi/Single threaded, Static/Shared).
stage : a build target which builds the compiled libraries to the stage directory (which you can set with
--stagedir=<STAGEDIR>). Contrast this with the
install target, which builds the compiled libraries, but also copies the header-only libraries to a particular location. This is generally an unnecessary step since you've already extracted the Boost headers somewhere already. Look inside the
Jamroot file inside your Boost folder for more details.