Boost logo

Boost-Build :

Subject: [Boost-build] Building and Installing Shared Boost Libraries on Windows
From: Andrey Sklyar (andrey_at_[hidden])
Date: 2016-02-07 12:48:51


I built boost 1.60.0 as shared libraries (configuration below). A couple
of things seem off, but I'm not sure if it's me not understanding Windows
or if it's something with the Boost build.

I built the boost library with this configuration:

.\b2 --build-dir=%BUILD_DIR% architecture=x86 address-model=64
runtime-link=shared threading=multi link=shared variant=debug
.\b2 headers

I added the include dir to the include path and was able to compile this
program:

include <iostream>
#include <string>
#include <boost/filesystem.hpp>

using namespace std;
using namespace boost::filesystem;

int main()
{
    for (directory_entry & entry : directory_iterator(current_path())) {
        cout << entry.path() << endl;
    }

    return 0;
}

When I tried to link it, it produced an error that it couldn't find
libboost_filesystem-vc140-mt-gd-1_60.lib

When I looked at the built artifacts, I saw that the .lib file was actually
named
boost_filesystem-vc140-mt-gd-1_60.lib

I manually renamed it to add the "lib" prefix. The linker liked it.
I then had to do the same thing with boost_system-vc140-mt-gd-1_60.lib

After adding the dll's paths to the runtime path, the program ran.

QUESTION 1:
It seems like, when linking against shared libraries on windows, the linker
is looking for link libraries with the "lib" prefix, but the Boost build is
creating .libs without that prefix. Which should it be?

QUESTION 2:
I would like to install (aka copy all of the libs, dlls, etc.) both the
release and debug versions of the build. What would be the right way to
tell Boost build to "install the binaries that resulted from the build in
%BUILD_DIR%".



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk