Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2007-02-11 18:15:09


Steve Johns wrote:
> Hi.
>
> I am new to Boost, and beginning with compiling example code for
> Boost::Date_Time.
>
> I've had success compiling the many examples given here:
>
> http://www.boost.org/doc/html/date_time/examples.html
>
> but the very first example given here:
>
> http://www.boost.org/doc/html/date_time/examples/general_usage_examples.html
>
> I cannot compile without errors. (Code given below)

Ugh, I hate when this gets out of sync...

> Changing week(1) to weeks(1) got me past the first hurdle, but still not
> home.

Yep.

> The problem seems to have something to do with 'Sunday' not being of the
> correct type, but I'm not truly certain what is going on, hence this post
> ...

Yeah, there's a problem with the automatic conversion -- making it explicit to
the type for the function (greg_weekday) does the trick for me on gcc-4.

     date d5 = next_weekday(d4, greg_weekday(Sunday));

> I'd appreciate any insight into what would be needed to get this example to
> correctly compile and run.
> (And if there is a flaw in the example, I'd suggest that the docs be fixed
> to provide it in working form.)

For sure -- I noted a couple other things that prevent the 'cut from the docs,
paste, and compile' technique from working. Added to my todos. Thx for the
report.

Thx,

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net