Date: Tue, 10 Feb 1998 21:32:41 -0800 (PST) Message-Id: <199802110532.VAA05847@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: mwilliams AT utah-inter DOT net, djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: HELP!!!! Precedence: bulk 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 and see if it works then. * Make sure you are using DJGPP v2.01, the latest version. * Scan for viruses, file corruptions, etc. * 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; } 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