In general, if the compiler complains about missing files, you need first to find out whether they at all exist on your system. For C header files, look in the include directory and its subdirectories; for C++ header files, look in the lang/cxx directory and its subdirectories; for libraries and the crt0.o file, look in the lib directory. Some header files and object files which are specific to a certain GCC version unzip into the lib/gcc-lib/djgpp/X.YZ directory (where X.YZ is the GCC version number, e.g. 2.95), so look there as well.
If a header file indeed is not there, and you cannot find it in the djdevNNN.zip and gppNNNb.zip distributions, it probably means that this header belongs to a package which isn't part of the basic DJGPP distribution. You need to find that package and install it. It is important to understand that if a package is missing, getting hold of the header files like socket.h is not enough: you need the library of the functions whose declarations and prototypes are in the header. For socket.h, you need a sockets library, such as libsock; see DJGPP packages. For graphics.h, you need GRX and the Borland-to-GRX interface, BCC2GRX (rename the file libbcc.h to graphics.h); see BCC2GRX interface package.
If the header or the library does in fact exist on your machine, then in order for the compiler to find them, you should have the following variable set in your environment13:
set DJGPP=c:/djgpp/djgpp.env
and it should point to the correct path of the file DJGPP.ENV on your system; the file itself is in djdev203.zip in the DJGPP distribution. In the above example it is assumed to be in the C:\DJGPP directory, but you should set it as appropriate for your installation.
Many of the problems with "missing" files, including the highly-confusing message about -lgcc ("File format not recognized"), are usually caused by having the DJGPP variable set incorrectly. The following describes some problems with defining DJGPP which pop up frequently on the DJGPP forum.
Sometimes, people make errors in their AUTOEXEC.BAT that cause the DJGPP variable to be defined incorrectly, or not defined at all (some of the more common errors are listed below). To check what is the actual setting, type from the DOS prompt:
set > env.dat
then examine the contents of the file env.dat. You should see there a line like this:
DJGPP=c:/djgpp/djgpp.env
If a line such as this isn't there, you should investigate the cause for this (see below for some of the possibilities).
Many problems with setting DJGPP happen when people put excess blanks around the = character, which has the effect of defining "DJGPP " (with the blank) which is not the same as "DJGPP" (without blanks). You should make sure there are no such excess blanks, or DJGPP won't find its files.
Another possible cause of DJGPP variable not being set is that you invoke another batch file from your AUTOEXEC.BAT before the line that sets DJGPP. Make sure such batch files are invoked with the CALL statement, because otherwise the subsidiary batch file will never return to process the rest of AUTOEXEC.BAT (that's a "feature" of DOS batch file processing).
The code that processes DJGPP.ENV assumes that this file resides in the main DJGPP installation directory. If that assumption is wrong, the compiler (and some other DJGPP programs) might fail to find some of the files or auxiliary programs they need. Do NOT move DJGPP.ENV to any other directory!
Note that if you run DJGPP on Windows/NT, you cannot use long names of the directories in the pathname of DJGPP.ENV when you set the above variable in the environment; you should use their 8+3 aliases instead. That's because Windows/NT doesn't support the LFN API for DOS programs, so the DJGPP startup code won't be able to find the DJGPP.ENV file using its long pathname. For example, the following setting won't work on Windows/NT because Development is longer than 8 characters:
set DJGPP=c:/Programs/Development/Djgpp/djgpp.env
If the DJGPP variable is set correctly, then check the following possible causes of this misbehavior:
You have edited the file DJGPP.ENV in a way that invalidated some of the settings there; try restoring the original file from the distribution to see if that fixes your problems. Editing DJGPP.ENV is not recommended, but if you must edit it, make sure you are familiar with its syntax in advance. The DJGPP server has a page with a description of the DJGPP.ENV syntax.
The syntax of DJGPP.ENV is also described in the DJGPP Knowledge Base, which comes with the djdev distribution.
You renamed the gcc.exe driver to some other name. In this case, you should edit the file DJGPP.ENV to add a section named after the new name of GCC, which is an exact duplicate of the section called [gcc]. DJGPP start-up code uses this file to find environment variables which it should put into the environment before the main function is called, but it searche