I currently don't have a lot of internet quota so I didn't want to install the latest boost libraries. Instead I installed Boost 1.49 using the Synaptic Package Manager and my Debian DVDs.

Now that boost (seems to be) installed, how I can I include the headers and link to the binaries when I compile my code? Do I still have to compile boost or is it already compiled for my machine? I can run bjam, which produces this:

warning: No toolsets are configured. warning: Configuring default toolset "gcc". warning: If the default is wrong, your build may not work correctly. warning: Use the "toolset=xxxxx" option to override our guess. warning: For more configuration options, please consult warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html

error: error: no Jamfile in current directory found, and no target references specified.

Not surprisingly, it doesn't find what it's looking for. The link given takes me to a configuration page that doesn't seem to contain what I'm looking for.

In Windows, I would unzip the files to C:/Program Files/Common Files and then run bootstrap followed by b2 ... to compile boost for my PC. These instructions seem to assume that we already know where boost actually is...

  • 1
    Typically its in /usr/include/boost. Which packages exactly did you install? Did you make sure to include the -dev packages? – derobert Apr 21 '14 at 5:36
  • Also, if you're installing from the Debian packages, then boost should already be compiled for you. You can just use it. – derobert Apr 21 '14 at 5:37
  • @derobert Thanks. Does this mean I can just #include boost/... and the compiler will know where to look? I've got libboost as well as the -dev packages. How do I tell my compiler which to use? – quant Apr 21 '14 at 5:52
  • 1
    Yeah, just #include <boost/whatever> and it'll work. For a few of them, you'll need to add an -llibname option to the linker as well. – derobert Apr 21 '14 at 6:02
  • @derobert I use the serialization library a bit which needs the lib files, do I need to then specify where they are or just include that option regardless and it'll find it? – quant Apr 21 '14 at 6:27

First, you don't want to use bjam, even though the Boost project uses it, and seemingly recommends it. It is terrible. Just use make instead, or possibly cmake, or scons.

Second, many of the Boost libraries are header files only, so you don't need to link against a library. In a few cases there is a library, which you then have to link against, using -l libname as usual. Also, of course, specifying the library/header paths is not necessary, because the system knows where it is.

The Debian Boost binary package is of course precompiled, so you don't have to compile anything in Boost. This is what binary means. Read the documentation, and if you can't figure it out, give more details about what you are trying to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.