Boost logo

Boost Users :

From: Bart (bartmann.nsd_at_[hidden])
Date: 2005-09-09 16:34:57


On Fri, 09 Sep 2005 14:44:00 +0200, Michael Haubenwallner wrote:

> Hi,
>
> There's a problem on HP-UX (especially hppa2.0w-hp-hpux11.11) with gcc-3.3.6,
> where localtime_r and gmtime_r are not in namespace std.
>
> boost-1.33 itself is built with "<cxxflags>-pthread/<linkflags>-pthread"
>
> $ cat xx.cc
> #include <boost/date_time/posix_time/posix_time_system.hpp>
>
> $ g++ -pthread xx.cc
> In file included from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/date_clock_device.hpp:12,
> from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/gregorian/gregorian_types.hpp:26,
> from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/posix_time/posix_time_config.hpp:14,
> from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/posix_time/posix_time_system.hpp:13,
> from xx.cc:1:
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp: In
> static member function `static tm* boost::date_time::c_time::localtime(const
> time_t*, tm*)':
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp:56: error: `
> localtime_r' undeclared in namespace `std'
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp: In
> static member function `static tm* boost::date_time::c_time::gmtime(const
> time_t*, tm*)':
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp:64: error: `
> gmtime_r' undeclared in namespace `std'
> $
>
> $ gcc -v
> Reading specs from /mnt/toolsjunk/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.6/specs
> Configured with: /mnt/toolsjunk/snapshot/src/sasrvb/toolsbox-3.5.0.16rc.20050904/buildroot/gcc/gcc-3.3.6/configure --with-gnu-as --with-as=/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/hppa2.0w-hp-hpux11.11/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix --with-local-prefix=/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX --disable-nls --prefix=/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX
> Thread model: posix
> gcc version 3.3.6
>
> Two maybe interesting notes:
>
> 1)
> /usr/include/time.h only declares localtime_r/gmtime_r if '-pthread'
> compiler-flag is used (and therefore _REENTRANT is defined).
>
> 2)
> gcc-shipped <ctime> does not pull localtime_r/gmtime_r into namespace std
>
> Thanks!
>
> ~haubi

c_time.hpp is the only place where localtime_r and gmtime_r are used.
Neither instance is preceded by a std::.

Looking back through previous versions of c_time.hpp, also shows no usage
preceded by a std::.

I attempted your example and am unable to duplicate your error. I would
suggest you check your copy of c_time.hpp against the one found in cvs
(found here) http://tinyurl.com/9jrd2

Bart


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