Why STDLIB.H is missing


stdlib.h, the standard include file for ANSI C, is not available on all Athena workstations.. The standard compiler on Athena is not ANSI compiliant, and as such, doesn't have that header file available for it; the stdio.h file defines the standard I/O functions, but does not have everything that stdlib.h does.

Athena is not yet running a fully ANSI compliant system; there are several other header files described in the standard that do not exist. To write a program that will compile correctly on both ANSI and non-ANSI systems, put this text at the top of your .c file:

	#if defined(__STDC__) && !defined(__HIGHC__)
	#include <stdlib.h>
	#endif
The symbol __STDC__ is always defined by an ANSI C compiler, and that code tells the compiler only to #include <stdlib.h> if it is defined, so it will not be included on non-ANSI systems.

The functions that are declared in stdlib.h on an ANSI system are, for the most part, available in libc.a (the library that is automatically linked with every C program).

For more information on these issues, see the stock answers on What C COMPILERS are available and What is ANSI C.