tags:

views:

409

answers:

2

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.

+1  A: 

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 ;
Todd Gardner
Thanks for the answer. This works, but is this the correct way to specify the prebuilt boost libraries? The thing that i'm trying to do is that when someone with fresh (and correct) install of boost build pulls my project, it should just compile. I'll have to add this to the question :-)
cube
I'm fairly sure it will work if someone has installed boost_date_time, but I couldn't say if it is best practices. You might have more traction on a boost mailing list: http://www.boost.org/community/groups.html#jamboost
Todd Gardner
+1  A: 

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.

Vladimir Prus