Boost logo

Boost Users :

Subject: Re: [Boost-users] linking and including in visual studio
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-04-28 00:42:59

On 27/04/2016 08:14, David Medine wrote:
> Having learned to write and compile C++ code on Linux, I am always in
> the habit of explicitly stating the include and library paths for the
> compiler to search for, as well as the libraries themselves that need to
> be linked. However, I am revising some Visual Studio projects that use
> boost and I realized that the path I gave for 'Additional Library
> Directories' is $(BOOST_ROOT)/lib, but my version of boost hasn't got
> this directory (it's actually $(BOOST_ROOT)\libs). I then removed all
> references to boost from 'Additional Library Directories', and
> 'Additional Include Directories' and the application builds and runs
> swimmingly.
> This leads me to believe, that assigning the BOOST_ROOT environment
> variable in Windows is the only step that is needed for VS's auto
> linking magic to link correctly to boost. Am I right here, or is there
> something I am missing?

No, there has to be something somewhere supplying the include and
library paths.

What VS does have (and GCC does not) is auto-linking, which merely
allows you to avoid having to explicitly specify the names of the Boost
libraries to link with. But this is just the names, not the paths.

There are many places that library paths can hide, however; they can
   * the project settings
   * property sheets imported by the project
   * the LIBPATH environment variable
   * Tools -> Options -> Projects and Solutions -> VC++ Directories (on
older versions of VS) or the Microsoft.Win32.Cpp.user.props sheet (on
newer versions of VS)

There might even be a few more than I'm unaware of. :)

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at