www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/11/03:39:24

From: G DOT DegliEsposti AT ads DOT it
To: djgpp AT delorie DOT com
Message-ID: <C12565A8.002E3075.00@vega.ads.it>
Date: Wed, 11 Feb 1998 09:36:24 +0100
Subject: Re: HELP!!!!
Mime-Version: 1.0




>Hope somebody can help me. I'm a real newbie to 'C' programming, trying
>to teach myself with your fine software and a copy of "C for
>Dummies"...an appropriate choice...:)

I don't agree with this. Very often books for "beginners" are worse then
books for "intermediate" because they teach you incorrectly, see below.

>       The first lesson is how to compile, link and run a simple
>(really, really simple) source file and produce an .exe file. It appears
>to work, and produces an exe file, and doing an [ALT F5] shows an output
>screen with the text as it should be. Once it's compiled, I get an "Exit
>code 17" or "Exit code 22" in Rhide, but although it says "no errors" in
>the lower window, it also says Access denied. I don't know if these
>messages are normal; I didn't find anything in a quick look over the
>FAQ's. My problem is that if I try to run it from the DOS prompt, it
>says "program too big to load". I have plenty of spare RAM, both
>conventional and extended, and the program size is 78Kb. I've tried it
>on 3 different PC's now; a 486/66, Dos 6.2: a486 DX4/100 running Win95,
>and a full-blown Pentium 220MMX. I've tried starting in DOS, or invoking
>the DOS prompt from Windows, and I get the same message on all 3 PC's.
>Any ideas?

Well, "no errors" means that everything has gone fine: no compile errors
and no run time errors.

The "Exit code XX" means that your program returned to DOS a value XX.
This is because ANSI C programs are expected to *return a value* to the
calling environment.

>    This is the source file:
>#include <stdio.h>
>
>void main()

This is probably the cause of the problem: it should be "int main()"
with "void main()" your program doesn't return a value so rhide
reads a "random" number. This explains why sometimes you have 17 and
sometimes 22.

>{
>    printf("GO AWAY, MORON!\n");

BTW: Hey, where has the "hello world!" gone? :-)

here put "return 0;"

>}


ciao
  Giacomo


- Raw text -


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