Date: Wed, 30 Apr 1997 02:17:19 -0400 (EDT) From: Michael Phelps To: maf01028 AT acan DOT net cc: djgpp AT delorie DOT com Subject: Re: VERY basic question In-Reply-To: <5k688j$2vp$1@newserve.gulftel.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 30 Apr 1997 Robert DOT L DOT Mackey AT delorie DOT com wrote: > I am using DJGPP V2.01and RHIDE. I have been using them for 3 days. > I have tried to teach myself c and c++. I wrote a standard "Hello, World" > program, and it chrashed. I was running under a DOS box in W3.1 so I > wouldn't have to fool with DPMI. The program is as follows. Windows provides _only_ DPMI for DOS boxes. In DJGPP V2, you have no choice but to use DPMI. > #include "include/stdio.h" > void main() { suggest: int main() { /* operating system wants an int returned */ > printf("Hello World", %s); oops...you're passing "%s" where: a) no variable "s" has been declared b) the function is expecting the address of a string Instead, try something like: char s[] = "Hello world"; printf("%s\n", s); /* "%s\n" means "print a string, then newline*/ /* s is the address of the array called "s" */ return 0; /* if you declared int main(), need to return an int */ > } > First it complained about a file, include/sys/djtypes.h, which it said > was missing. (It wasn't.) I played around with <>s and "" and finally > got that fixed. Then it said somthing about a parse error before the %. > Finally, it compiled. I ran the program and got shot back to windows, > where it said HELLO.EXE had violated system integrity. HOW DOES > "HELLO, WORLD" VIOLATE SYSTEM INTEGRITY. Any thoughts? > > Also, I downloaded the C++ compiler and library files. The library files > say I have to run a makefile or something like that. How do I do that? Huh? Just unpack the .zip files, call the setdjgpp program, and compile with gxx for C++ programs (just append ".cc" or ".C" (uppercase) or ".cpp" for C++ programs). > > Also, I learned the syntax and rules and all that.. Now what do I do > with this? I can't think of any programs to write. I don't know Get a good C programming book. > any graphics or anything like that Any tips for a beginner? > > PLEASE REPLY TO maf01028 AT acan DOT net. DON'T HIT REPLY! Thanks a lot for the help. > > David Mackey. >