Bug report -- gcc-2.95
J. J. Farrell
jjf@bcs.org.uk
Tue Nov 30 23:39:00 GMT 1999
> From: Mark Schoenberg <mark@lpb.niams.nih.gov>
>> Mumit Khan's port of gcc-2.95 for Cygwin failed to compile the following
> simple subroutine with the command "gcc -v -O2 -mno-cygwin -c mdate.c -o
> mdate.o".
>> #include <sys/time.h>
> char *mdate()
> {
>> time_t ts;
> char *ntime, *ctime(), buf[100];
> int ni;
>> time(&ts);
> ntime = ctime(&ts);
> strcpy(buf,ntime);
> ni= strlen(buf);
> buf[ni-1] = '0円';
> strcpy(ntime,buf);
> return (ntime);
> }
>> mdate.c: In function `mdate':
> mdate.c:5: `time_t' undeclared (first use in this function)
For POSIX and C compliance you should be including <time.h> rather
than <sys/time.h>. I don't know if this will fix your problem, but
it will give you stronger grounds for complaint if it doesn't.
Just as an aside: ctime() is declared in <time.h> so would be better
not declared here; you should also be including <string.h>; and it
seems a waste of effort to copy from and to ntime!
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list