Click here to Skip to main content
15,887,477 members
Articles / Programming Languages / VC++
Tip/Trick

Create An Environment to Build the C++ Boost Libraries in Windows for VS2013

Rate me:
Please Sign up or sign in to vote.
4.78/5 (6 votes)
5 Jul 2015CPOL3 min read 15.5K   12   2
This project is intended for one to create an automated build environment to build the Boost libraries set to be used with VC++ in Visual Studio 2013.

Introduction

This project is intended for one to create an automated build environment to build the Boost libraries set to be used with VC++ in Visual Studio 2013.

I have created a set of make files to automate the build of the C++ Boost libraries using the `nmake` build tool that comes with Visual Studio. I have put the make files and other related files in github. The Github URL:

https://github.com/stevenong2006/BoostBuild_VisualStudio2013

I’ve also created a tutorial video and uploaded to youtube at:

https://www.youtube.com/watch?v=n2l845gH4xc&feature=youtu.be

For this version, I’ve tested with `boost_1_59_0` and Visual Studio 2013 community version. In a nutshell, the end product will be the Boost libraries set that built as the following flavors:

  • static debug
  • static release
  • staticX64 debug
  • static X64 release
  • share debug
  • share release
  • shareX64 debug
  • shareX64 release

The Boost libraries can either build as static or shared and Visual C++ projects can be configured as 32 bit or 64 bit. Also, the projects can be configured as debug or release. Since the Visual C++ linker is employing auto-link, depending on the current project configuration, it will look for a particular library name patterns to link with. The link will fail if the library with the particular name cannot be found.

As an example, to link with the `date time` static library in debug 32 mode, the linker will look for:

libboost_date_time-vc120-mt-sgd-1_59.lib

Whereas for the shared 64 release mode, it will look for:

boost_date_time-vc120-mt-1_59.lib

Preparation

The following softwares are needed to be installed properly prior to the build:

Procedure

Setup gihub and Clone the Repository

  • You need to create an account in github and sign in using the `GitHub` program (If you not have an account in github yet, create one from https://github.com/).
  • Start the `git shell` program and navigate to the folder where the Boost libraries are going to be built. Type this command to clone the repository locally:
    git clone https://github.com/stevenong2006/BoostBuild_VisualStudio2013.git
  • As a result, the following folder/file hierarchy is created:
    • BoostBuild_VisualStudio2013 (folder)
      • src (folder)
        • 7z.dll
        • 7z.exe
        • bzip2-1.0.6.tar.gz
        • Expat2.1.0.zip
        • icu.7z
        • user-config.jam
        • zlib-1.2.8.tar.gz
      • Config.mnk
      • Makefile_BoostLib.nmk
      • Makefile_main.nmk
  • Copy/move the “boost_1_58_0.zip” file into the `src` folder

Build the Boost libraries set using nmake tool

  • From the installed Visual Studio, start “Developer Command Prompt for VS2013”
  • Navigate to the newly created folder `BoostBuild_VisualStudio2013` where the `Makefile_main.nmk` is. Type the following command:
    nmake /f Makefile_main.nmk all
  • This will kick-off the build process. All the zip files will be extracted and the boost libraries set will start to build. The build activities will be logged into the `Boost_Build.log` for the record. If you have `tail` installed, you can view the activities in real time by:
    tail -f Boost_Build.log
  • As a result, a folder called `boost_1_59_0_MsVCBuild` is created. If the build goes successfully, you will find the mentioned Boost libraries set in this folder.

Conclusion

The C++ Boost is one of the powerful libraries set. It's a great tool set to those who program C++ seriously. To start learning C++ Boost, you can look at the available libraries at (http://www.boost.org/doc/libs/) and learn how to use them.

I hope this tip will spark the interest of learning the Boost library in you.

Enjoy!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Weatherford International
United States United States
I am a software engineer. I have been coding for over two decades now. I love coding - coding is my life! My other hobbies are: tinkering with those Single Board Computers (SBC) and swimming.

Comments and Discussions

 
GeneralReally great stuff! Pin
david211146-Jul-15 7:12
david211146-Jul-15 7:12 
GeneralRe: Really great stuff! Pin
stevenong_20066-Jul-15 7:52
stevenong_20066-Jul-15 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.