Date: Tue, 24 Feb 1998 13:10:59 -0700 From: Mike Williams Subject: [Fwd: HELP!!!!] To: djgpp AT delorie DOT com, eldredge AT ap DOT net Reply-to: mikewilliams3 AT mci2000 DOT com Message-id: <34F32952.DE60585A@mci2000.com> MIME-version: 1.0 Content-type: MULTIPART/MIXED; BOUNDARY="Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA)" Precedence: bulk This is a multi-part message in MIME format. --Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit --Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA) Content-type: MESSAGE/RFC822 Date: Tue, 24 Feb 1998 12:59:48 -0700 From: Mike Williams Subject: Re: HELP!!!! To: Nate Eldredge Cc: eldredge AT ap DOT com, djgpp AT delorie DOT com Reply-to: mikewilliams3 AT mci2000 DOT com Message-id: <34F326B4 DOT C017CE1B AT mci2000 DOT com> MIME-version: 1.0 X-Mailer: Mozilla 4.02 [en] (Win95; I) Content-type: MULTIPART/ALTERNATIVE; BOUNDARY="Boundary_(ID_qYe9o6NbGJO5451PNdRgjg)" X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; uuencode=0; html=0; linewidth=80 References: <199802110532 DOT VAA05847 AT adit DOT ap DOT net> --Boundary_(ID_qYe9o6NbGJO5451PNdRgjg) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Nate Eldredge wrote: > At 12:29 2/10/1998 -0700, Mike Williams wrote: > >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...:) > > 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. > I don't know about the "too big to load" message. It's come up a few times > and I never heard what the cause or the solution was. Try these: > * Compile your file from the command line: > gcc -o foo.exe foo.c > I did that. > and see if it works then. > No difference > * Make sure you are using DJGPP v2.01, the latest version.Got that! > * Scan for viruses, file corruptions, etc. > None! > * If none of these helps, post again. I have some more specific ideas about > finding the problem. > In any case, if you find what caused or fixed this problem, please post a > summary so your solution can help other people. > > Read on for the fix to the "Exit code 22" problem. > >Any ideas? > > This is the source file: > >#include > > > >void main() > >{ > > printf("GO AWAY, MORON!\n"); > >} > This is wrong. According to ANSI C, the `main' function must return an > `int'. If not, behavior is "undefined" and usually results in funny return > codes. If there were no errors, that return value should be 0. Correct code: > > #include > > int main(void) > { > printf("Hello, world\n"); /* more friendly :) */ > return 0; > } Thanks, that > fixed the error exit problem. > I think you should get rid of the Dummies book. Their examples are no good, > and that doesn't help at all. Someone else, here or on comp.lang.c, might be > able to recommend a better one. You might also check the comp.lang.c FAQ. > (_The_C_Programming_Language,_Second_Edition_ is recommended frequently and > is practically the definitive reference, but I don't know how well it works > as a tutorial. The First Edition wasn't bad...) > > Nate Eldredge > eldredge AT ap DOT net Thanks for the input..now I hope you can help again. If I compile and run the program, it works from within rhide,as before, but as soon as it has run, the bottom window has the following message:- permission denied (EACCESS) no errors As Christian (ChrHenz AT aol DOT com) and you suggested earlier, I have experimented with using "int main()" instead of the original "void main()" as instructed by the rather silly C for Dummies book from which I'm trying to learn C. Unfortunately, the office budget will not run to a "proper" book Also, including the "return 0;" statement took care of the exit error problem. I still can't get the blasted thing to run outside Rhide, though...still the "too big to load" error. Something else I noticed is that if I try to run it from within Win95, instead of opening a DOS window, as other DOS files do, it says "this is not a valid win32 program" None of these errors are fatal, or anything, because I'm still learning C, and as long as they work from within Rhide, I know the source code is working. It's just that once I start writing "real" programs, it would be nice if they would actually run independently! Still, at the rate I'm progressing, that day is still a long way off, however eager my boss is that I start editing some applications! Thanks for your help! Mike --Boundary_(ID_qYe9o6NbGJO5451PNdRgjg) Content-type: text/html; charset=us-ascii Content-transfer-encoding: 7bit    Nate Eldredge wrote:
At 12:29  2/10/1998 -0700, Mike Williams wrote:
>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...:)
>       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.
I don't know about the "too big to load" message. It's come up a few times
and I never heard what the cause or the solution was. Try these:
* Compile your file from the command line:
  gcc -o foo.exe foo.c                                                         I did that.
and see if it works then.                                                      No difference
* Make sure you are using DJGPP v2.01, the latest version.Got that!
* Scan for viruses, file corruptions, etc.                                None!
* If none of these helps, post again. I have some more specific ideas about
finding the problem.
In any case, if you find what caused or fixed this problem, please post a
summary so your solution can help other people.

Read on for the fix to the "Exit code 22" problem.
>Any ideas?
>       This is the source file:
>#include <stdio.h>
>
>void main()
>{
>       printf("GO AWAY, MORON!\n");
>}
This is wrong. According to ANSI C, the `main' function must return an
`int'. If not, behavior is "undefined" and usually results in funny return
codes. If there were no errors, that return value should be 0. Correct code:

#include <stdio.h>

int main(void)
{
   printf("Hello, world\n"); /* more friendly :) */
   return 0;
}                                                               Thanks, that fixed the error exit problem.

I think you should get rid of the Dummies book. Their examples are no good,
and that doesn't help at all. Someone else, here or on comp.lang.c, might be
able to recommend a better one. You might also check the comp.lang.c FAQ.
(_The_C_Programming_Language,_Second_Edition_ is recommended frequently and
is practically the definitive reference, but I don't know how well it works
as a tutorial. The First Edition wasn't bad...)

Nate Eldredge
eldredge AT ap DOT net

 Thanks for the input..now I hope you can help again. If I compile and run the program, it works from within rhide,as before, but as soon as it has run, the bottom window has the following message:-
permission denied (EACCESS)
no errors
As Christian (ChrHenz AT aol DOT com) and you  suggested earlier, I have experimented with using "int main()" instead of the original "void main()" as  instructed by the rather silly C for Dummies book from which I'm trying to learn C. Unfortunately, the office budget will not run to a "proper" book  Also, including the "return 0;" statement took care of the exit error problem. I still can't get the blasted thing to run outside Rhide, though...still the "too big to load" error. Something else I noticed is that if I try to run it from within Win95, instead of opening a DOS window, as other DOS files do, it says "this is not a valid win32 program"
    None of these errors are fatal, or anything, because I'm still learning C, and as long as they work from within Rhide, I know the source code is working. It's just that once I start writing "real" programs, it would be nice if they would actually run independently! Still, at the rate I'm progressing, that day is still a long way off, however eager my boss is that I start editing some applications!

Thanks for your help!

Mike
   --Boundary_(ID_qYe9o6NbGJO5451PNdRgjg)-- --Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA)--