Compiling and Linking ViewKit Programs

This section describes how to compile ViewKit ObjectPak programs.

Required Packages

To compile and link with the ViewKit ObjectPak libraries, you must have a C++ compiler, X11R5 and OSF/Motif 1.2 libraries.

Required Header Files

Depending on whether or not you made links, all ViewKit ObjectPak header files appear in the following directories:

  • /usr/include/Vk (if you made system links)
  • ${ObjectPak}/include/Vk (if you did not make links)

In most cases, the header file for a given class is the class name followed by ".h". For example, the header file for the VkWindow class is <Vk/VkWindow.h>. Some minor classes are grouped together into single header files. For example, the header file for the VkMenu class automatically includes the header information for every type of menu supported by ViewKit ObjectPak. These cases are noted in the text where appropriate.

You need to include OSF/Motif header files for only those OSF/Motif widgets that you explicitly use in a ViewKit ObjectPak program. ViewKit ObjectPak automatically includes any X or OSF/Motif header files required by ViewKit ObjectPak components that you use in your program.

Required Libraries

You must link all ViewKit ObjectPak programs with the ViewKit ObjectPak library, libvk, and the OSF/Motif and X libraries. If you use an external help system with your application, you should link with an appropriate help library; otherwise, you should link with the ViewKit ObjectPak help library, libvkhelp. (Refer to Appendix C-- Using a Help System for information on using a help system with ViewKit ObjectPak applications.)

For example, to compile a file hello.C to produce the executable hello, enter:

CC -o hello hello.C -lvk -lvkhelp -lXm -lXt -lX11

If you are debugging a program, you might find it useful to compile your program with the debug libraries, which contain additional symbol table information.