|
Boost Users : |
From: Black Ice (yg-boost-users_at_[hidden])
Date: 2003-01-04 01:36:42
Detail error message:
d:\boost\boost\boost\date_time\time_duration.hpp(66) : error C2668: 'abs' :
ambiguous call to overloaded function
d:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\math.h(528): could be 'long abs(long)'
d:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\math.h(530): or 'double abs(double)'
d:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\math.h(536): or 'float abs(float)'
d:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\math.h(584): or 'long double abs(long double)'
d:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\stdlib.h(265): or 'int abs(int)'
while trying to match the argument list
'(boost::date_time::time_resolution_traits<frac_sec_type,res,resolution_adju
st,frac_digits>::fractional_seconds_type)'
with
[
frac_sec_type=boost::int64_t,
res=nano,
resolution_adjust=0x03b9aca00,
frac_digits=9
]
-- /*******************/ 自由(liberty)无非就是这样一种承诺:每个人将会得到一种保障,保障我们可以与 权威、多数、流俗及舆论的影响相抗衡。 /*******************/ "Black Ice" <yg-boost-users_at_[hidden]> 写入消息新闻 :av5tpc$fmj$1_at_main.gmane.org... > After I move the line 'using std namespace', the error still occurs. > The error occurs in file date_time/time_duration.hpp, line 66. > min_type minutes() const > { > return std::abs(((ticks() / (60*rep_type::res_adjust())) % 60)); > } > > > > > -- > /*******************/ > 自由(liberty)无非就是这样一种承诺:每个人将会得到一种保障,保障我们可以 与 > 权威、多数、流俗及舆论的影响相抗衡。 > /*******************/ > > > "Black Ice" <yg-boost-users_at_[hidden]> 写入消息新闻 > :av2tmo$42o$1_at_main.gmane.org... > > boost version 2002-01-02 > > VC 7.1 Final Beta > > "error C2668: 'abs' : ambiguous call to overloaded function" when compile > > following code. The same code can be built successfully in vc6. > > Any suggestion are appreciated. > > > > #define DATE_TIME_INLINE > > #define BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG > > > > #include <iostream> > > #include <string> > > using namespace std; > > > > #include <boost/date_time/gregorian/gregorian.hpp> > > #include <boost/date_time/posix_time/posix_time.hpp> > > > > using namespace boost::gregorian; > > using namespace boost::posix_time; > > > > void testDateTime2() > > { > > date d(2002, Nov, 1); //an arbitrary date > > ptime t1(d, hours(5) + nanosec(100));//date + time of day offset > > ptime t2 = t1 - minutes(4)+seconds(2); > > ptime now = second_clock::local_time(); //use the clock > > //Get the date part out of the time > > date today = now.date(); > > date tommorrow = today + date_duration(1); > > ptime tommorrow_start(tommorrow); //midnight > > > > cout << "d is " << to_iso_extended_string(d) << endl; > > cout << "t1 is " << to_iso_extended_string(t1) << endl; > > cout << "t2 is " << to_iso_extended_string(t2) << endl; > > cout << "now is " << to_iso_extended_string(now) << endl; > > cout << "today is " << to_iso_extended_string(today) << endl; > > cout << "tommorrow is " << to_iso_extended_string(tommorrow) << endl; > > cout << "tommorrow_start is " << to_iso_extended_string(tommorrow_start) > << > > endl; > > > > //starting at current time iterator adds by one hour > > time_iterator titr(now,hours(1)); > > for (; titr < tommorrow_start; ++titr) { > > cout << to_iso_extended_string(*titr) << endl; > > } > > } > > > > > > -- > > /*******************/ > > 自由(liberty)无非就是这样一种承诺:每个人将会得到一种保障,保障我们可 以 > 与 > > 权威、多数、流俗及舆论的影响相抗衡。 > > /*******************/ > > > > > > > > > > > > > > > > Info: <http://www.boost.org> > > Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> > > Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]> > > > > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > > > > > > > > > > > > > > Info: <http://www.boost.org> > Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> > Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]> > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > > >
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