delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/04/01:26:08

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199607040519.AA274157552@relay1.geis.com>
Date: Thu, 4 Jul 96 05:01:00 UTC 0000
To: laurin AT cyberhighway DOT net
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: new to djgpp

Reply to message 0927462    from LAURIN AT CYBERH on 07/03/96  8:09PM


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Warning to all those reading the list:  this is a very long response!  If you
quote the entire thing and send me a one line reply saying, "You shouldn't
have written such a long post," I will hunt you down and I will kill you.  Feel
free to point out any factual errors, however.  ;)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

>man! i am lost with this. i used to be fluent in basic(about a decade ago!),
>and i think i can catch on to c and c++, but trying to get a compiler to
>work, might make me shoot myself! i have tried z80(by hytek) and it locked
>up my system every time. now, i get djgpp, it looks much better, no, it
>looks, much LARGER! i am completely lost. there is no doc and i can't even
>get this stupid thing to compile. PLEASE, somebody shove my face into the
>potatoes, or tell me where to start. do i just expand all the zip files? or
>is there some kind of installation? which exe is the compiler? what does all
>that other stuff do? i can't afford to buy one of those expensive compilers
>with all the documentation, so i'm going to have to fight through this crap.

Ok... let's take this twenty or thirty points at a time:

1)  First and foremost, C is a very difficult language to "just dive into."
Unless you're someone who picks up programming languages like
dogs pick up fleas, you'd best find a good book or a good friend to
teach you the basics.

2)  Coming as you say you have from BASIC, you are at an even
worse disadvantage because C is an extremely structured language.
Creating even a simple program requires a lot of knowledge that
seems very foreign to those who have worked with linear, interpreted
languages.  And I wouldn't even _think_ of touching C++ until you are
at least halfway competent in C.

3)  DJGPP is a very large and complex compiler, and it is very unlike
most IDE-based compilers like QBASIC, Turbo Pascal, Borland C, etc.
Unless you also obtain an IDE like RHIDE, you must use some very
complex commands to compile your programs.  If you are familiar with
Unix, this comes easier, but it can still be a major pain to learn.

4)  DJGPP comes with an extremely complete and comprehensive
set of documentation.  However, since DJGPP is a free compiler, there
has been no concerted effort to write any kind of instruction manual for
its use.  Note that instructions are different from documentation; DJGPP's
documentation was written for the purpose of reference, not teaching.
There is an effort underway to create a manual for DJGPP, however it
is likely to be some time in coming.  :)

Now, on to some specific DJGPP instructions:

First, did you read the file 'readme.1st' that can be found in the v2 directory
of any simtel tree where DJGPP is located?  It details all the files you
need to download and how to install them.  In case you missed it, here's a
(brief) synopsis:

A) Get these files from your favorite ftp site:  djdev200.zip, gcc272b.zip,
bnu252b.zip, txi360b.zip, csdpmi2b.zip, and faq200b.zip (or faq210b.zip,
if it's there by now).

B) Create a directory called C:\DJGPP, and move these files into it.

C) Unzip the files like this:  pkunzip -d *.zip

(If you don't have pkunzip, then you are in serious trouble, and had
better start learning more about DOS.  :)

D) In your autoexec.bat file, insert the following line:
SET DJGPP=C:\DJGPP\DJGPP.ENV

E) In your autoexec.bat file, append C:\DJGPP\BIN to your PATH.

F) Reboot your computer so the new settings can take effect.

Now, on to compilation.  I am not going to tell you how to write C here,
but suffice it to say that all compilation using DJGPP is done from the
MS-DOS command line.  The program that you will use to compile your
code is called 'gcc'.  To compile a program, simply type this:

[Assuming your program is called 'myprog.c']
gcc -o myprog.exe myprog.c

This tells gcc to compile myprog.c and output (-o = Output) the executable
myprog.exe, which you can then run.  Note that capitalization (especially
with the command-line options) is absolutely critical when using DJGPP
programs.  -O is NOT the same thing as -o.

If gcc gives you error messages, then you have made a mistake.  Go and
fix your program and try again.  If you want to see a bunch of sample C
programs, download djtst200.zip and mak373b.zip and install them in the
same way as the rest of your DJGPP programs.  Browse through the
subdirectories under DJGPP\TESTS to find a program that looks interesting
and compile it by typing 'make <program.exe>'.  (Make is a GNU utility
that makes compilation of complex programs easier.  It's required to
compile the samle programs.)

When you know enough about C to begin asking questions about how
DJGPP works, I suggest that you read the Frequently Asked Questions
list (faq200b.zip or faq210b.zip), which answers almost every question
that novice users have about programming under DJGPP.  Please look
there first before asking on this newsgroup.  The file 'txi360b.zip' contains
a documentation viewer called 'info', which can allow you to read the
DJGPP documentation in hypertext format; this includes the FAQ as well,
assuming you downloaded it.

I hope this helps you in your struggles to learn C.  :)

John

- Raw text -


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