Many people have problems with compiling the Platform SDK samples. Most of the time, it is because the use of the wrong header and lib files. For the rest of this article, I assume you will be using VC++ 6.0 SP3 or later, and that VC and the PSDK are installed to their default directories.
The samples should be compilable without changes to any source code. A makefile is provided so that they can be compiled from the command line. Compiling from an IDE is a little more complicated.
The Platform SDK contains a bunch of headers and lib files. It is important to use the PSDK versions and not the versions that come with the compiler.
Open up a command prompt and do the following. Note that it all has to be done within the same command prompt, environment variable are not saved between instances of the command prompt. You should be able to cut and paste the following into a batch file, if you want.
c:
cd "\program files\Microsoft Visual Studio\VC98\Bin"
vcvars32.bat
cd "\program files\Microsoft Platform SDK"
setenv.bat
cd "\program files\Microsoft Platform SDK\samples\netds\tapi\tapi2"
nmake
cd "\program files\Microsoft Platform SDK\samples\netds\tapi\tapi3"
nmake
This should compile all the samples, you can go into individual samples and do the same. Some TAPI3 samples may require a little more work to compile because they require ATL 3.1.
Compiling from the IDE is a little more work, I'll use Dialer as an example. Note that some of these settings are global options and will affect your other projects.
Do a Open Workspace.
Change file type to "Makefiles".
Go to the Dialer sample directory.
For the filename, type in "makefile".
It will convert the makefile into a VC++ project, which you should Dialer.
Do an "Add Files to Project" and add the rest of the source code.
Go to Tools, Options, Directories Tab.
Under Include Files, add to the top of the list "C:\Program Files\Microsoft Platform SDK\Include"
Under Include Files, add to the second in the list "C:\Program Files\Microsoft Platform SDK\Include\ATL30".
Under Library Files, add to the top of the list "C:\Program Files\Microsoft Platform SDK\Lib".
You should then be able to Build Dialer.exe without any more problems.
If you compile using either method and it complains, then inspect both versions of the header file, and determine for yourself which it is using and which it should be using. Finally, if you are still having problem and you are using my downloads please delete them and install the Platform SDK properly, from the official Microsoft download, and try again. The full \include\ directory is 40+ megs, I only provide the parts which I thought were significant but I may have missed some files.
|
|
|
|
|
|
|