Do i have static or dynamic boost libraries?

后端 未结 5 2044
长情又很酷
长情又很酷 2020-12-08 17:04

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

<
相关标签:
5条回答
  • 2020-12-08 17:35

    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

    0 讨论(0)
  • 2020-12-08 17:42

    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 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
    
    0 讨论(0)
  • 2020-12-08 17:47

    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.

    0 讨论(0)
  • 2020-12-08 17:51

    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
    
    0 讨论(0)
  • 2020-12-08 17:53

    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...

    0 讨论(0)
提交回复
热议问题