Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-01-26 07:13:41

John Torjo wrote:
>Hartmut Kaiser wrote:
>>John Torjo wrote:
>>>Again, I'm pretty frustrated that some libraries have source files that
>>>need to be compiled separately (using bjam).
>>>I was thinking that we could have a directory '/boost/impl', and each
>>>library that has sourse files could have an .hpp file that includes all
>>>of its source files (that would normally need to be compiled separately).
>>>This way, any user, even not having bjam, can include the implementation
>>>of a library, as simple as:
>>>// this is included in ONLY one source file
>>>#include <boost/impl/filesystem.hpp>
>>>As a regular user, I'd rather have the above, than having to use bjam to
>>>build a library.
>>>If people agree, I volunteer to create the /boost/impl directory for all
>>>the libraries that now need to be compiled separately, somewhere this
>>That's not always reasonable.
>>>From the point of view of the Wave library (I file a review request
>>shortly), certainly you _can_ include all of the library at once, but this
>>would raise compilation times up to hours! That's why Wave contains
>>source files, which only purpose is to separate certain template
>>instantiation into it's own translation unit. For the average user
>>compilation time drops drastically this way.
>I must have mis-explained something.
>The user should include the implementation ONLY IN ONE TRANSLATION UNIT.
>It's like compiling the source files separately.

Still, the problem will occur for that single source file (even if it is
only compiled once).

What I have done with the date-time library is to include the source files I
need, e.g.:

#include <iostream>
#include <boost/date_time/posix_time/posix_time.hpp>

#include <libs/date_time/src/gregorian/greg_month.cpp>
#include <libs/date_time/src/gregorian/greg_weekday.cpp>

int main()
   std::cout << "current date/time: " << boost::posix_time::to_simple_string
   return( 0 );

You could create a boost.cpp file for each project, or create a common file,
that includes the necessary source files, e.g.:

// boost.cpp
#include <libs/date_time/src/gregorian/greg_month.cpp>
#include <libs/date_time/src/gregorian/greg_weekday.cpp>

Then you can add boost.obj to your project. As Hartmut said, adding all the
Wave source files would lead to a very long compile time by compiling code
that you don't need for the project. Ideally, it would be nice to have a
boost.lib file that can be added to your project, but this depends on the
compiler/platform being used :(.


It's fast, it's easy and it's free. Get MSN Messenger today!

Boost list run by bdawes at, gregod at, cpdaniel at, john at