Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't boost::filesystem header only?

Out of intellectual curiosity, I was wondering why the boost::filesystem library had a compiled component, while in other cases no compiled components are necessary. What is in the compiled portion that can not be in a hpp?

What really confuses me is that on my computer I compile this portion anyway (before using the library), and I would thus expect it to be possible or even preferred to perform the same compilation I did in BJam every time I build my application.

Why is there the additional .so/.a file?

like image 850
Mikhail Avatar asked May 19 '12 14:05

Mikhail


People also ask

Is Boost :: filesystem header-only?

Some boost libraries are header-only and some other need to be built (system, filesystem, graph, mpi, serialization, etc); several boost libraries can be configured to be either header-only or separately built.

Is Boost :: thread header-only?

Boost. DateTime: This dependency is mandatory, but even if Boost. DateTime is a non header-only library Boost. Thread uses only parts that are header-only, so in principle you should not need to link with the library.

What is Boost Filesystem?

The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories. The motivation for the library is the need to be able to perform portable script-like operations from within C++ programs.

Where is Boost header?

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


1 Answers

Some boost libraries are header-only and some other need to be built (system, filesystem, graph, mpi, serialization, etc); several boost libraries can be configured to be either header-only or separately built.

The advantages of separately built libs are quite obvious: your own project compiles faster and depends on less external code.

However, build complexity is the tradeoff.

like image 156
Igor R. Avatar answered Sep 25 '22 03:09

Igor R.