🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3539

g++ -ansi not recongizing stdlib's erand48

#3539
From: Fred Ma
Date: Tue, 18 Mar 2003 00:18
32 lines
2087 bytes
Hi,

I've been advised to use "gcc -ansi" to maintain portable
code.  I have the following file erand.cpp (an example):

     #include <cstdlib>
     #include <vector>
     using namespace std;

     struct myrand { public:
        vector<unsigned short> xseed;
        double operator()(void) { return erand48(&xseed[0]); };
     };

     myrand RndGenr;

I get the following compiler messages:

     $ g++ -c -ansi erand.cpp
     erand.cpp: In member function `double myrand::operator()()':
     erand.cpp:7: `erand48' undeclared (first use this function)
     erand.cpp:7: (Each undeclared identifier is reported only once for each
        function it appears in.)

I understand that erand48 is not standard C, but doesn't it's
appearance in stdlib *make* it defined?  Why would it be
treated any differently from any other prototype in any other
include file?  I did confirm that erand48 is in stdlib.

Thanks for any comments.  I'm using gcc 3.2 on cygwin 1.3.20-1.

Fred
Technical Details
Message-ID: <3E7665C2.B40DC681@doe.carleton.ca>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,39656fba4b7778f2,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: fc89c,39656fba4b7778f2,start
X-Google-Attributes: gidfc89c,public
X-Google-ArrivalTime: 2003-03-17 16:28:11 PST
Message-ID: <3E7665C2.B40DC681@doe.carleton.ca>
From: Fred Ma <fma@doe.carleton.ca>
X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.unix.programmer,gnu.gcc.help
Subject: g++ -ansi not recongizing stdlib's erand48
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 33
Date: Mon, 17 Mar 2003 19:18:11 -0500
NNTP-Posting-Host: 64.230.88.85
X-Complaints-To: abuse@sympatico.ca
X-Trace: news20.bellglobal.com 1047946918 64.230.88.85 (Mon, 17 Mar 2003 19:21:58 EST)
NNTP-Posting-Date: Mon, 17 Mar 2003 19:21:58 EST
Organization: Bell Sympatico
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail