when using gnulib's mktime test any cpp file that #includes ctime will receive the following errors:
In file included from time.cc:6: /usr/include/c++/4.3/ctime:73: error: ‘::mktime’ has not been declared time.cc: In function ‘int main()’: time.cc:11: error: ‘mktime’ was not declared in this scope this happens on both Ubuntu 9.04 and FreeBSD 7.1. it was discovered when trying to port drizzle to FreeBSD and testing with the minimal test-case showed the same problem on linux. the problem is more prevelant on FreeBSD because ctime is #included by other systems headers, but it would affect any cpp program trying to use the mktime test and ctime on linux/ubuntu as well. the problem is that ctime does the following: ... #include <time.h> ... #undef mktime ... using ::mktime ... the undef mktime gets rid of the config.h mapping of mktime to rpl_mktime and when using ::mktime happens there's no longer a mktime symbol. attached is a ~minimal test program that exhibits the problem. so far i've only found work-arounds that remove the mktime.m4 behavior and thus are undesirable. animal$ uname -a Linux animal 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12 UTC 2009 x86_64 GNU/Linux animal$ gcc --version gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ralph$ uname -a FreeBSD ralph.local 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 r...@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 ralph$ gcc --version gcc (GCC) 4.2.1 20070719 [FreeBSD] Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. thoughts? best, -- -rm
gnulib-mktime-bug.tar.gz
Description: GNU Zip compressed data