delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/05/14/01:50:03

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Nicholas Sherlock <n DOT sherlock AT gmail DOT com>
Subject: Re: Using rand_r
Date: Thu, 14 May 2009 17:49:18 +1200
Lines: 26
Message-ID: <gugbct$7vf$1@ger.gmane.org>
References: <guga4l$5qk$1 AT ger DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051201 Thunderbird/1.5 Mnenhy/0.7.3.0
In-Reply-To: <guga4l$5qk$1@ger.gmane.org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

David Billinghurst wrote:
 > Nicholas Sherlock wrote:
 >> Hey everyone,
 >>
 >> I'm trying to use the function rand_r with gcc-4 in Cygwin 1.7, all 
my packages are up to date. It's supposed to be defined in stdlib.h, and 
I can see it there. But if I compile a program which uses it, I get:
 >>
 >> warning: implicit declaration of function 'rand_r'.
 >>
 >> The reason seems to be the check for #ifndef __STRICT_ANSI__ in 
stdlib.h. Even though I'm compiling with -std=c99, __STRICT_ANSI__ still 
gets declared, so the definition of rand_r is unavailable. This seems to 
be the same problem stated here:
 >
 >
 > Try -std=gnu99.  It doesn't define __STRICT_ANSI__
 >
 > This doesn't answer your question, unfortunately.

Thanks, that does solve my immediate problem. But I'm really hoping to 
compile as vanilla C99 as I can manage, since I'll also be using my code 
with non-GNU compilers.

Cheers,
Nicholas Sherlock


--
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