delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/28/02:16:27

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: game programming
Date: Sun, 27 Dec 1998 22:23:34 -0800
Organization: Alcyone Systems
Lines: 37
Message-ID: <368723E5.8BA9F9BE@alcyone.com>
References: <368603C8 DOT C7BDF4CA AT kolumbus DOT fi> <7676rr$qq9$1 AT nnrp1 DOT dejanews DOT com>
NNTP-Posting-Host: kamali.alcyone.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.0.30 i586)
X-Accept-Language: en, eo
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

leonj AT geocities DOT com wrote:

> This is the only I can help you with. Kinda simple, but I dunno why
> it
> happend to me too. Change the return type for main from just main()
> "int
> main" and then at the very end of the program type "return 0".

The prototype

    extern main();

_does_ have the return type int -- in C, the return type defaults to int
if not specified.  That is, the program

    main() { return 0; }

is perfectly valid ANSI C (but doesn't do anything).

The problem was that the program was explicitly declared to return void,
which is an ANSI violation.

> I also have he same book and have not been able to compile anything
> from it.

It's clear that the book was never intended to be used with DJGPP; I
think the original poster was just mistaken.  The FAQ will help with
converting such programs to DJGPP.

-- 
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900
Alcyone Systems / irc maxxon (efnet) / finger max AT finger DOT alcyone DOT com
  San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
          USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
             \
            / God is love, but get it in writing.
           / Gypsy Rose Lee

- Raw text -


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