prev up next   top/contents search

comp.lang.c FAQ list · Question 10.11

Q: I'm compiling a program, and I seem to be missing one of the header files it requires. Can someone send me a copy?


A: There are several situations, depending on what sort of header file it is that's ``missing''.

If the missing header file is truly a standard one (that is, one defined by the ANSI C Standard, such as <stdio.h>), there's a problem with your compiler. Either the compiler wasn't installed properly, or your project is somehow not configured to find the standard header files. You'll need to contact your vendor, or someone knowledgeable about your particular compiler, for help.

In the case of nonstandard headers, the situation is considerably more complicated. Some headers (such as <dos.h>) are completely system- or compiler-specific. Some are completely unnecessary, and should be replaced by their Standard equivalents. (For example, instead of the nonstandard <malloc.h> and <memory.h>, portable source code should instead #include <stdlib.h> and <string.h>, respectively.) Other headers, such as those associated with popular add-on libraries, may be reasonably portable.

If the missing header file is an OS-specific one, such as <sgtty.h>, <sys/stat.h>, <netinet/in.h>, or <dos.h>, it may be that the program you're compiling was tailored to an operating system other than the one you're using. (It's also possible that some conditional compilation settings need to be adjusted.) It likely won't be possible to get the program working without rewriting its system-dependent portions. Simply getting copies of the missing header files wouldn't help--they typically contain declarations of the interfaces to the various system calls and libraries. Obtaining copies of the header files wouldn't get you copies of the libraries, and the libraries wouldn't be of any use (that is, they wouldn't work) without the underlying system calls, anyway. See also questions 19.1, 19.4, 19.12b, and 19.40c.

If the missing header file is for some external, add-on, third-party library, look for the header where you got the library. If you have some source code which #includes what appears to be an add-on header, but which you don't have, you probably don't have the library, either, and you'll need both. See question 13.25; see also question 18.16.

If the header file is unique to (that is, part of) the program you're trying to compile, your search will obviously begin at the spot where you found the program. (Again, see question 18.16.)

In general, however, asking if someone can ``send you a copy'' of a missing header file is not likely to be productive. Standard headers exist in part so that definitions appropriate to your compiler, operating system, and processor can be supplied. You cannot just pick up a copy of someone else's header file and expect it to work, unless that person is using exactly the same environment. Nonstandard headers--such as those specific to a particular operating system or third-party library--aren't generally any more portable; the OS-specific ones are likely to be very specific to a particular version and release of the OS, and the third-party ones are likely to be equally tied to a particular version of the library.

The bottom line is that a random person on the net is unlikely to be able to send you a working copy of the header file you (seem to) need. You may actually have a portability problem (see section 19), or a compiler problem (in which case you might be able to ask your compiler vendor why the file was not provided, or to send a replacement copy). Otherwise (if the header is third-party or application-specific), see question 18.16.


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North