Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do i have static or dynamic boost libraries?

Tags:

c++

boost

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?

like image 497
snoz Avatar asked Jan 06 '11 20:01

snoz


People also ask

Is Boost dynamically linked?

When the users runtime is dynamically linked the Boost libraries can be built either as dynamic libraries (. so's on Unix platforms, . dll's on Windows) or as static libraries (. a's on Unix, .

Should I use static or dynamic library?

Whereas using a static library means every file in your program must have it's own copy of the library's files at compile-time. The downside of using a dynamic library is that a program is much more susceptible to breaking. If a dynamic library for example becomes corrupt, the executable file may no longer work.

Where are Boost libraries installed?

The headers should be in /usr/local/include/boost and the libs should be in /usr/local/lib.

What is the difference between static and dynamic library?

What are the differences between static and dynamic libraries? Static libraries, while reusable in multiple programs, are locked into a program at compile time. Dynamic, or shared libraries, on the other hand, exist as separate files outside of the executable file.


1 Answers

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
like image 142
ehambright Avatar answered Sep 30 '22 18:09

ehambright