How to build boost Version 1.58.0 using Visual Studio 2015 (Enterprise)
Asked Answered
A

5

34

I like to build boost 1.58.0 using the (new) Visual Studio 2015 (Enterprise). In the past I proceeded in the following way:

  1. Download boost 1.58.0 from www.boost.org
  2. Extract files (e.g. C:\thirdparty\vs2013\x64\boost_1_58_0)
  3. Start Visual Studio 2013 x64 command prompt (VS2013 x64 Native Tools Command Prompt)
  4. Change to boost directory (e.g. cd C:\thirdparty\vs2013\x64\boost_1_58_0)
  5. Execute .\bootstrap.bat
  6. Execute .\b2 -j8 --toolset=msvc-14.0 address-model=64 --build-type=complete stage
  7. b2 -j8 --toolset=msvc-12.0 address-model=64 --build-type=complete stage --with-python

But in VS2015 there is not VS2015 command prompt.

Also the vcvarsall.bat is missing that I used sometimes to setup a VS2013 command prompt.

How can I compile the source code of boost using VS2015?

Aglow answered 22/7, 2015 at 14:57 Comment(5)
Just discoverd Developer Command Prompt for VS2015... mmh...Aglow
You are very likely going to run into "Unknown compiler version" issue as boost 1.58 does not know about VS2015. If so follow thisCrazy
You haven't said what problem you are actually having. Did you get errors? What errors? Have you considered asking in the Boost User mail list?Genitals
@Genitals I am trying to build Qt and I have the same issue. The shortcuts are nowhere to be found.Denman
@GrafikRobot: Which command or tool should I use to run bootstrap.bat successfully?Aglow
D
15

I Tried to install Qt and I had the same issue: vcvarsall.bat was missing. In my case the problem was that I unchecked The Visual C++ Common Tools.

I modified my VS 2015 installation and added the missing feature Common Tools for Visual C++ 2015:

enter image description here

After the modification, the File is in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

Denman answered 22/7, 2015 at 21:34 Comment(2)
You predicted the english phrase exactly... corresponding screenshot addedDecelerate
Installing the "Common Tools for Visual C++ 2015" solved the problem (this option is not enabled by default) – afterwards “VS2015 x64 Native Tools Command Prompt” is availableAglow
H
20

Unfortunately Boost documentation is quite verbose because it tries to take care of all OS and environments. Also, it skips over some time saving details. Here's quick steps specifically for VS2015 with Boost 1.61.

First, let's understand that Boost is huge library with lots of contributors. Consequently, all of the Boost code is divided in to two parts: headers only libraries and header+cpp libraries. The former doesn't require compilation. You just include them and you are done. Later does require building. You typically don't need to worry about extra steps of building, although its good idea to just set everything up once.

Using Boost Header Only Libraries

  1. Download the Boost archive in 7z format and extract using 7Zip. The zip file is much bigger than 7z file and can take over 20 minutes to extract by Windows Explorer vs 5 minutes by 7Zip.
  2. Create folder c:\Program Files\boost. Copy extracted boost_1_61_0 folder in this folder. This exact path is not a requirement but we will use that here.
  3. In whatever VC++ project you want to use Boost, go to that project's right click Properties > C/C++ > General > Additional Include Directories and add path C:\Program Files\boost\boost_1_61_0 without quotes.

Now you should be able to use most of the Boost libraries by using statement like #include <boost/thread/mutex.hpp>.

Using Boost Header+CPP Libraries

Examples of these are Boost.Chrono, Boost.Filesystem, Boost.GraphParallel, Boost.IOStreams, Boost.Locale, Boost.Regex, Boost.Thread, Boost.System etc. Unless you are using these libraries, following steps are not needed.

  1. First make sure you don't have Windows Driver Kit installed. If you have, uninstall it for now because most likely it has messed up include paths that will cause Boost's build script to fail.
  2. Invoke VS2015 x64 Native Tools Command Prompt as Administrator.
  3. CD to C:\Program Files\boost\boost_1_61_0 and then run bootstrap.bat.
  4. Run .\b2
  5. Run .\b2 variant=debug,release link=static runtime-link=static address-model=64
  6. Cut folder C:\Program Files\boost\boost_1_61_0\stage\lib and copy it to C:\Program Files\boost\boost_1_61_0\lib.
  7. For the VC++ Console project you want to use these libraries, right click Properties > Linker > General > Additional Library Directories and add path C:\Program Files\boost\boost_1_61_0\lib. For VC++ library projects you will find same setting in Properties > Librarian.

Now you are all set!

Note: Original question about not finding command prompt is addressed by answer from @Arnaud. Above are more clarified steps for Boost installation also step #5 below for more detail on command prompt.

Homorganic answered 22/9, 2016 at 0:9 Comment(3)
Nice answer, but not related to the problem "But in VS2015 there is not VS2015 command prompt."Aglow
This question, unfortunately, comes up top for anyone searching how to use Boost with VC++. Your question and other answers have described the process but its not entirely accurate. Originally I wanted to put corrections in comments but it was getting too long to fit in there so I created new answer. Above #5 is relevant to your question as well. In any case, I added a note on your original question.Homorganic
Check out also bitbucket.org/Vertexwahn/bluego - builds Boost libraries using Visual Studio 2010/12/13/15. You just have to start the application, select your configuration and hit the Build button- everything else works automatically.Aglow
D
15

I Tried to install Qt and I had the same issue: vcvarsall.bat was missing. In my case the problem was that I unchecked The Visual C++ Common Tools.

I modified my VS 2015 installation and added the missing feature Common Tools for Visual C++ 2015:

enter image description here

After the modification, the File is in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

Denman answered 22/7, 2015 at 21:34 Comment(2)
You predicted the english phrase exactly... corresponding screenshot addedDecelerate
Installing the "Common Tools for Visual C++ 2015" solved the problem (this option is not enabled by default) – afterwards “VS2015 x64 Native Tools Command Prompt” is availableAglow
D
1

below are the steps

1) Download library from below this site http://www.boost.org/

2) Unzip it.[I have extracted files at "F:\Internet-Downloads\boost_1_65_1" path]

Unzip Boost library -Directory

3) Open "Developer Command Prompt for VS2015" as shown in the below snapshot.

open_Developer_Command_Prompt

4) Go to the directory in which you have extracted your files.

5) run bootstrap.bat file as shown in the below snapshot

Run Bootstrap.bat

6) you will get installation information as shown in below snapshot

bootstrap.bat - result

7) start VS2015, and create a test application as shown in below snapshot

Test Application

8) include boost directory in your project[Project Propertry->C/C++->General->Additional Include Directories]as shown in below snapshot

Include Boost Directory in testapp

9) Run the application, add "_SCL_SECURE_NO_WARNINGS" in the preprocessor directory if you encounter with "error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe ......" error.[Priject Property->C/C++->Preprocessor->Processor Definitions]

enter image description here

10 output:

output

Dilly answered 7/10, 2017 at 13:49 Comment(0)
A
0

Use https://github.com/Microsoft/vcpkg from the VS Command Prompt.

Apetalous answered 27/10, 2017 at 9:14 Comment(0)
P
-2

To find and invoke VS2015 x64 Native Tools Command Prompt, just start typing "native" in Windows Start->Search programs and files text box. System should find command prompt

Preset answered 16/11, 2016 at 21:22 Comment(1)
You need to use Visual Studio 2017's Developer Command Prompt! It's found in Start - All Programs - Visual Studio 2017 - Visual Studio Tools - Developer Command Prompt for VS 2017 Original link: https://mcmap.net/q/451980/-building-boost-build-engine-39-cl-39-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-fileHydrocellulose

© 2022 - 2024 — McMap. All rights reserved.