cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/12/10:22:45

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie question
Date: Mon, 09 Jun 1997 20:14:50 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 49
Message-ID: <339C643A.5E6C@cs.com>
References: <19970609092108747 DOT AAA49 AT ireland DOT dnc DOT net>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp105.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Scott Alexander wrote:
> 
> im teaching myself c++ and when i tried to run this i get the
> following  errors  any help as to what is causing the error and what
> needs to change would be apricieated
> 
> math.c: in funtion 'main':
> match.c:2: warning: return type of 'main' is not 'int'

I would think this one would be obvious.  Your C book is idiotic; valid
C or C++ code must define main with an integer return type.  For the
reasons why, check out the comp.lang.c Frequently Asked Questions at
<http://www.eskimo.com/~scs/C-faq/top.html>.

> gcc.exe installation problem, cannot exec 'as': no such file or directory (ENOENT)

You also failed to download the GNU Binutils (v2gnu/bnu27b.zip) when you
installed DJGPP.  Get this package, and things should work properly. 
Also, check that the DJGPP 'bin' directory is in your PATH.

> this is the source code for the program
> 
> #include <stdio.h>
> void main () {
>      int x = 1;
>      int y = 2;
> 
>      printf("The sum of x + y is %d", x + y);
> }

Try this (the coding style is my own; use whatever you're most
comfortable with):

#include <stdio.h>
int main( void )
{
    int x = 1;
    int y = 2;

    printf( "The sum of %d + %d is %d.\n", x, y, x + y );
    return 0;
}

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


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