Platform SDK: DirectX |
This topic pertains only to applications written in C++. For an introduction to programming for DirectX in Visual Basic, see Visual Basic Programming Topics.
The samples included in this SDK use Microsoft® Visual C++® project files (MDP files) that describe the appropriate source files, project resources, and linker settings for each sample. However, you might need to make additional preparations to ensure that the samples compile and link properly, or you might need to prepare settings for a new project of your own. (For the samples, developers that use other compilers can reference the generic makefiles included for information about the required libraries, then configure their environment appropriately.) The information provided here applies to the DirectX samples and the DirectX applications that you create.
After opening a project file in Visual C++, verify some settings before trying to compile the application. The following descriptions are valid for Microsoft Visual C++ 5.0 and 4.2. Other versions of Visual C++ and other compilers have equivalent settings. If you do not use these versions of Visual C++, refer to the documentation provided with your development environment for information on changing these settings.
Note The following discussion uses the default installation paths (C:\Mssdk\Include and C:\Mssdk\Lib) to describe file locations. Your installation paths might differ.
Be sure that the search path for header files is correct and the directory for DirectX header files is the first path that the compiler searches. To check the include path, choose Options from the Tools menu; then select the Directories tab. The following dialog box will appear.
The topmost path indicates the folder that contains the latest DirectX header files. The default path is C:\Mssdk\Include. If the path is not present, add it to the list, and move it to the top of the search list by using the toolbar controls within the Directories tab.
Check the search paths and search order that the linker uses to search for link libraries. The link search paths are also listed on the Directories tab. Choose Options from the Tools menu; then select the Directories tab. When the dialog box appears, choose the Library files option in the Show directories for: drop-down list box. The topmost path should be the folder that contains the latest DirectX link libraries. The default path is C:\Mssdk\Lib. (Borland link libraries are provided in the Borland folder within the default folder.)
If you are using the provided sample project files, you do not need to verify these settings; they are specified with the provided project files. For new applications, choose Settings from the Project menu to make the following dialog box appear. (In Visual C++ 4.2, this is the Settings item on the Build menu.)
All DirectX applications link to the Dxguid.lib include library, which defines the globally unique identifiers (GUIDs) for all DirectX Foundation COM interfaces. (You can also define INITGUID prior to all other include and define statements in a single source module.) In addition, verify that the application is linked to the appropriate standard DirectX link libraries. The following table shows the various DirectX foundation components that might be used and the corresponding link libraries for those components.
Component | Link library (*.lib) |
---|---|
Direct3D Immediate Mode | D3dim.lib, D3du.lib |
Direct3DX Utility Library | D3dx.lib, D3dxd.lib (debug) |
Direct3D Retained Mode | D3drm.lib, D3dxof.lib |
DirectDraw | Ddraw.lib |
DirectInput | Dinput.lib |
DirectMusic | None |
DirectPlay | Dplayx.lib |
DirectSetup | Dsetup.lib |
DirectSound | Dsound.lib |
(All components) | Dxguid.lib |