delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/10/03:31:44

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: compile warning
Date: Fri, 09 May 1997 23:41:57 -0400
Organization: Cornell University http://www.cornell.edu
Lines: 29
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <3373EE85.63CE@cornell.edu>
References: <3373AC95 DOT 2D64 AT osu DOT edu>
Reply-To: asu1 AT cornell DOT edu
NNTP-Posting-Host: cu-dialup-0025.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ross Litscher wrote:
> 
> Hi, I am kind of new to c++ and brand new to djgpp. I got about 98% of
> the following code off the internet. The problem is that I get a 
> warning after I compile this. It is as follows:
> 
> vidmode2.cpp(30) Warning: implicit declaration of function 'int
> rand(...)'

read the docs. find out that rand is declared in stdlib.h, include
stdlib.h. now, was that so hard?

> void main(void)

first, this is pure and simple C. in any case, void is not a valid
return type for main. main has to return an int. if you can't think of
values EXIT_SUCCESS and EXIT_FAILURE are good ones (also in stdlib.h.)

-- 
   Sinan
 
*******************************************************************
 A. Sinan Unur                                WWWWWW
                                              |--O+O
 mailto:sinan DOT unur AT cornell DOT edu                C   ^ 
 http://www.people.cornell.edu/pages/asu1/     \  ~/ 

Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************

- Raw text -


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