From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: problems with void main(...) Date: Wed, 02 Jul 1997 08:24:41 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 33 Message-ID: <33BA1049.46F6@cs.com> References: <33B95552 DOT 7C88 AT traditor DOT fi> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp101.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Pauli Saksa wrote: > > #include > void main(short argc) > { > printf("argc: %d", argc); > return; > } > > and here's the compiler's messages: > > In function `int main(...)': > warning: `return' with no value, in function returning non-void > > so... could someone tell what I've done wrong? > I'm new to djgpp so there may be some defaults or something I > haven't noticed... Simple. main() is not supposed to return a void value. You are probably compiling the above code as C++ (by using capital letters on your command line or some such) and the compiler automatically converts the return type of main() to an integer and then expects a return at the end of the function. Solution: always use the ANSI-correct definition for main(). -- --------------------------------------------------------------------- | John M. Aldrich | "To be 'matter of fact' about the | | aka Fighteer I | world is to blunder into fantasy-- | | mailto:fighteer AT cs DOT com | and dull fantasy at that, as the real| | http://www.cs.com/fighteer | world is strange and wonderful." -LL | ---------------------------------------------------------------------