Mail Archives: cygwin/2004/11/25/14:22:26
On 11/25/2004 at 10:25:28 AM, cygwin-owner wrote:
> I trying to link a small C/C++ program and I got linking error on
time(),
> rand() and srand(). These should be part of libc right? So way are they
> missing? Has cygwin some special libc implementation or something???
--- end of excerpt ---
This works for me. What is your output when compiling?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char **argv)
{
srand((unsigned int)time(NULL));
for (int i=0; i<10; ++i) {
printf("Random #%d: %d\n", i, (int)rand());
}
return 0;
}
"The stuff we call "software" is not like anything that human society
is used to thinking about. Software is something like a machine, and
something like mathematics, and something like language, and
something like thought, and art, and information...
but software is not in fact any of those other things."
Bruce Sterling - The Hacker Crackdown
Fred A. Kulack - IBM eServer iSeries - Enterprise Application Solutions
ERP, Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982)
mailto:kulack/us.ibm.com Personal: mailto:kulack/gmail.com
AIM Home:FKulack AIM Work:FKulackWrk
MSN Work: fakulack/hotmail.com (replace email / with @)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -