Each sample included with the Microsoft® DirectX® Software Development Kit includes a makefile that you can use to build the sample from the command line. You can then run the sample to see what it does. When you find a sample that interests you, you might want to explore further and step through the code yourself. If you want to build and debug samples (or your own code) using Microsoft Developer Studio, you will want to create a project within Developer Studio. This article discusses how to create a project in Developer Studio version 5.0. The project file must include the necessary source files and libraries, and Developer Studio must be configured with the correct library and include paths so that the compiler can locate the required library and header files.
Note See the readme.txt file in the DirectX SDK Samples directory for information about building samples from the command line.
This article contains the following sections.
You must specify where the header and library files from the DirectX SDK are located when using Developer Studio. These settings are global within Developer Studio and do not need to be repeated for each project.
Perform the following steps to add the DirectX SDK header and library directories to the include and library file search paths.
The following screen shot shows the Directories tab of the Tools Options dialog box with the default include directory at the top of the directory list.
Perform the following steps to create a new project.
This section discusses how to add the appropriate libaries to your project and how to set the working directory. Open a project in Developer Studio before proceeding.
The required libraries vary from project to project, depending on the technology the code uses. If in doubt about the libraries required for a particular sample, search the makefile in that sample's directory and include the same library list. The following table lists the most commonly used libraries included with the DirectX SDK. The Winmm.lib library included with the Platform SDK includes additional multimedia functionality as well.
DirectDraw | ddraw.lib |
Direct3D Retained Mode | d3drm.lib |
DirectSound | dsound.lib |
DirectPlay | dplayx.lib |
DirectInput | dinput.lib |
For example, the Tex1 sample's makefile lists ddraw.lib and d3drm.lib because it uses Microsoft DirectDraw® and Direct3D® Retained Mode.
The following screen shot shows the Link tab of the Project Settings dialog box. It specifies the settings for all configurations and adds multimedia and DirectX libraries to the beginning of Developer Studio's default Object/library modules list.
You might need to set the working directory to make sure your program can find certain files. For example, you might need to load an image from the directory in which your program resides. By default, Developer Studio sets the current working directory to the directory in which it resides, rather than to the directory containing your program.
Perform the following steps to set the working directory.
The following screen shot shows the Debug tab of the Project Settings dialog box. It specifies a working directory for the Win32 Debug configuration.
Perform the following steps to add any required files to your project. Open a project in Developer Studio before proceeding.
Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.