delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/08/14:39:04

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4C87CA1A.9070301@sh.cvut.cz>
References: <CD7CFA1134410784EA0A1AA09A4D2A5B AT ericlin DOT fsshl DOT zzn DOT com> <4C87CA1A DOT 9070301 AT sh DOT cvut DOT cz>
Date: Wed, 8 Sep 2010 13:38:35 -0500
Message-ID: <AANLkTi=jeOB1WLKFDF2WA6Ap4=mdQPonpo4gmUqySOpS@mail.gmail.com>
Subject: Re: rand() was not declared in this scope, please help&#8207;
From: mike marchywka <marchywka AT gmail DOT com>
To: cygwin AT cygwin DOT com
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

On 9/8/10, V=E1clav Haisman <v DOT haisman AT whithaus DOT giv> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> eric lin wrote, On 8.9.2010 19:35:
>> dear cygwin/gcc users:
>>
>>   I compile a simple code which i copied from a book, "The Complete
>> Reference of C++"  Fourth Edition by Herbert Schildt in page 575, rand()
>> which is clearly not be included in
>> #include <iostream>
>>
>> I tried
>> #inlcude <cmath>
>>
>> it still not compile, i.e. same compile error
>>
>> please help(see which lib I should include)
>> /* I tried in ubuntu linux on my laptop, it also not compile by same
>> reason */
> You need to #include <cstdlib> and use std::rand().
>
> - --
> VH
goog:

http://www.google.com/#sclient=3Dpsy&hl=3Den&q=3Drand%28%29+include+header&=
aq=3Df&aqi=3D&aql=3D&oq=3D&gs_rfai=3D&pbx=3D1&fp=3Dfb33825a2a74a863

also I'd mention that grepping in the include path can work.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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