This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: Bug report -- gcc-2.95
- To: cygwin at sourceware dot cygnus dot com
- Subject: Re: Bug report -- gcc-2.95
- From: "J. J. Farrell" <jjf at bcs dot org dot uk>
- Date: Tue, 2 Nov 1999 19:27:48 -0800 (PST)
> 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