delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/25/14:22:26

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
In-Reply-To: <Pine.GSO.4.61.0411251122350.14489@slinky.cs.nyu.edu>
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: Re: linking problems using gcc
Message-ID: <OF7D9358C0.6E45FD7C-ON86256F57.0069EF47-86256F57.006A6596@us.ibm.com>
From: Fred Kulack <kulack AT us DOT ibm DOT com>
Date: Thu, 25 Nov 2004 13:22:09 -0600
X-IsSubscribed: yes

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019