Mail Archives: djgpp/1997/06/12/10:22:45
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 -