Xlib, Xt, and Motif all have header files (also called #include files) that an application must include in its code. However, the Motif header files themselves include the required Xt files, which in turn include the required Xlib files. An application usually needs to include only the proper Motif files.
All Motif applications must include the file <Xm/Xm.h>. This file contains definitions that all applications need. Each Motif widget also has a #include file. An application must include this header files for all widgets it creates. In addition, some groups of Motif routines have their own header files. Required #include files for each Motif widget and routine are documented in the Motif Programmer's Reference.
Instead of using a large number of header files for particular widgets and routines, an application can include <Xm/XmAll.h>. This file incorporates all documented Motif header files. Including <Xm/XmAll.h> may slow compilation a little; however, including <Xm/XmAll.h> will not increase the size of the resulting application. In other words, the link profile will not change as a result of including <Xm/XmAll.h> instead of including individual header files.
When building a Motif application, a developer must link the program with the appropriate libraries. Xlib, Xt, the Motif toolkit, and MRM have separate libraries. An application that does not use MRM must be linked with the Motif toolkit, Xp, Xext, Xpm, Xt, and Xlib libraries. An application that uses MRM must be linked with these libraries and also with the MRM library. A developer might also need to link the application with additional libraries, depending on the platform and operating system. Consult your system administrator and vendor documentation for more information on the libraries required for Motif applications.