14

I have ran bjam.exe --build-dir="C:\build-boost" --build-type=minimal msvc stage

and now I have libraries .lib with these headers, for example

libboost_serialization-vc100-mt
libboost_serialization-vc100-mt-1_45
libboost_serialization-vc100-mt-gd
libboost_serialization-vc100-mt-gd-1_45

I believe these should be static libraries for debug and release version. When I run the compiler with Multi-threaded Debug (/MTd) it gives an error LNK1104: cannot open file 'libboost_serialization-vc100-mt-sgd-1_45.lib' It is looking for one with -sgd

where am i going wrong?

snoz
  • 141
  • 1
  • 1
  • 3
  • 1
    Maybe you can try building using "--build-type=complete” as this will build all supported variants of the libraries. See section "5.3.4 Invoke bjam" in http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html – yasouser Jan 06 '11 at 21:36

5 Answers5

29

Something that is kind of confusing is there are two 'static' options for building boost with MSVC.

B2.exe takes the option link=static which tells boost that you want to link it (boost) statically. If you are compiling your VC project with /MT or /MTd you will also need to use the runtime-link=static option to tell boost that you will be linking to the VC runtime libraries statically.

It is the second runtime-link=static which puts the -s in the .lib name.

My command line for building boost was

b2.exe --toolset=msvc variant=release link=static threading=multi runtime-link=static stage
ehambright
  • 1,416
  • 19
  • 27
4

You have the dynamic versions. The static ones are delimited by having the "s" in the name. Make sure you specified link=static on the bjam command line. If not, you'll have to rebuild to make the static versions.

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
  • does it suppose to give me any `.dlls` at the end? I only got the `.libs` in stage folder. – snoz Jan 06 '11 at 21:09
  • @snoz: You're looking in the wrong folder then. On Windows boxes, the libs are treated as build artifacts, which are then copied into the output folder when compile of each library is complete. You'll have to find where the directory containing both the dlls and the libs are located. – Billy ONeal Jan 06 '11 at 21:13
2

here is how i break it down

libboost_serialization-vc100-mt-sgd-1_45.lib

lib- if boost library starts with lib then its a static library , shared library do not start with lib prefix. Also static library will have a '-s' in the name.

mt- multi-threaded , obtained by specifying threading=multi when you ran bjam or b2.This is the default threading.

g- use debug libraries for building the code
d- build a debug version of your code

So your compiler is searching for multi-threaded static debug library(mt-sgd) as you ran with /MTd(Creates a debug multithreaded executable file using LIBCMTD.lib). I guess by default it must be searching for static library. If you want a dynamic library, insert these lines in your code or define a macro

#define BOOST_ALL_DYN_LINK
Vihaan Verma
  • 12,815
  • 19
  • 97
  • 126
2

See Boost getting started windows section 6.3 naming and section 6.1 on Unix naming

For static libraries there should be a s in there e.g. -sgd so you have dynamic libraries

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
1

Please check this document: http://www.boost.org/doc/libs/1_45_0/more/getting_started/windows.html#library-naming

There you can find the meanings of all letters and how you can build the boost accordingly also...

meakgoz
  • 568
  • 4
  • 18