Question

I am using boost build in my project and now i want to use boost date_time. I've googled and found that it should (probably) be used this way:

exe test : test.cpp /boost/date_time//date_time ;

but then i get this message:

error: Unable to find file or target named
error:     '/boost/date_time//date_time'
error: referred from project at
error:     '.'

(when i use -lboost_date_time as a gcc flag manually, then it works correctly) I thought that the library oly has to be added to site-config.jam, so i tried adding this:

project /boost/date_time ;
lib date_time ;

but it has no effect.

What am i doing wrong?

Thaks

Edit: I'm not looking for a solution that just works. I need something that will work for everyone with correct install of boost.build and boost libraries.

Was it helpful?

Solution

I recommend that you take a look at contrib/boost.jam module in the current versions of Boost.Build. It allows you to declare necessary targets for every library almost automatically.

Or original attempt is not exactly right. To have "/site-config//boost_date_time" working you need to have this in site-config.jam:

project site-config ;
searched-lib boost_date_time ;

This will work, on Linux, if the library file is named libboost_date_time.so (which is the case if Boost was built with --layout=system). On Windows, you don't actually need anything of that, thanks to autolinking.

OTHER TIPS

I don't have a ton of experience with boost build, but I believe your specification in site config is off (see here and here). If you are trying to put a prebuilt boost_date_time in your site-config, then it should be:

project site-config ;
lib b_date_time : : <name>boost_date_time ;

And in your directory:

exe test : test.cpp /site-config//b_date_time ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top