How to set up DJGPP
Last update: 2004-12-18
Copyright © 2004 Salvatore Isaja
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included by reference.
This document describes how to download and install DJGPP on your computer, to let you compile C programs under a DOS compatible system, such as FreeDOS, MS-DOS, Windows 95/98/ME, or even (using recent DJGPP versions) Windows 2000/XP.
DJGPP is a very powerful 32-bit programming toolset (the compiler, the linker and so on), and, being the DOS port of the GNU programming tools, it is free software.
What to download
You can download DJGPP from Delorie Software. Follow the Getting DJGPP link and choose your favourite FTP mirror, then you can start downloading packages. There are several available, but to compile C programs (including FreeDOS-32) you need only few of them.
At the very least, you will need to download the following packages:
v2/djdev203.zip |
the standard GNU C library (libc) ported to DOS by DJ Delorie |
v2gnu/bnu215b.zip |
the GNU Binutils, including the assembler and the linker |
v2gnu/gcc342b.zip |
the GNU C compiler (gcc) |
v2gnu/mak3791b.zip |
GNU Make, used to compile a whole project at once |
Please note the version number in the file names (the final 'b' stands for "binary"): it should be OK to download files with a different version number than above, but if you have problems, you may want to consider if that is the reason. For example, only new DJGPP packages (especially, GNU Make) are known to work under Windows 2000/XP. The above packages versions should work. Usually, the newer, the better.
You may also want to download the following packages (although they are not required):
v2/readme.1st |
a text file with an introduction to DJGPP |
v2/faq230b.zip |
these FAQs are the most comprehensive document about DJGPP |
v2/djlsr203.zip |
source code of the DJGPP libc, can be a good reference |
v2gnu/gpp342b.zip |
the GNU C++ compiler (g++) |
v2gnu/txi47b.zip |
GNU texinfo, a program to read documentation of GNU applications |
v2apps/rhide14b.zip |
a Borland-like integrated development enviroment (IDE) |
v2misc/csdpmi5b.zip |
CWSDPMI is a free 32-bit DPMI server (or DOS extender), needed if you want to run your own programs compiled with DJGPP on plain DOS (not required inside a Windows DOS box) |
v2misc/csdpmi5s.zip |
source code of CWSDPMI, some code can be used for FD32 too |
Unpacking and configuring
Once you have downloaded the packages, create a directory for DJGPP wherever
you want (for example c:\djgpp) and unzip these files in that directory:
the directory tree of DJGPP will be created automatically. Just answer "yes" if
you are asked to overwrite the content of some subdirectories.
Put the DJGPP bin directory
(for example c:\djgpp\bin) in your path and
set the DJGPP environment variable to the path of the djgpp.env
file in your DJGPP directory, like this:
set PATH=c:\djgpp\bin;%PATH% set DJGPP=c:\djgpp\djgpp.env
Under Windows, if you like using the Dev-C++ editor, the easiest thing to
do is placing the above two lines in a batch file and run it in a DOS command
prompt window. In this way you can keep both the Dev-C++ window and the command
prompt window open, write your code with Dev-C++, save it and switch to the
DOS command prompt window to compile it using make (see below for
the full procedure).