Problems building samples from Platform SDK

I have installed the "Microsoft Platform SDK" and followed Brian Johnson's instructions (http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx) to enable it to be used with "Visual C++ 2005 Express Beta 2", successfully (hooray!).

I then wanted to build some of the samples in the SDK.
I first tried building in the command line for "Microsoft Visual C++ Toolkit 2003" (which I had previously downloaded), and received linker errors mentioning "cannot open file LIBCMTD.lib". I tried building in the command line for the "... Beta 2" and got a dialog box saying that the file Hcrtf could not be found. I then went back to trying to use "...Toolkit 2003" and this time it behaved like the"...Beta 2", with a dialog box saying that Hcrtf could not be found.

This is a command line excerpt showing how I tried to build some samples:

Setting environment for using Microsoft Visual Studio 2005 x86

C:\Program Files\Microsoft Visual Studio 8\VC>cd..

C:\Program Files\Microsoft Visual Studio 8>cd..

C:\Program Files>cd "Microsoft Platform SDK"

C:\Program Files\Microsoft Platform SDK>setenv

Attempting to detect a Microsoft Visual Studio installation


Targeting Windows XP 32 DEBUG


C:\Program Files\Microsoft Platform SDK>cd samples

C:\Program Files\Microsoft Platform SDK\Samples>cd begin

C:\Program Files\Microsoft Platform SDK\Samples\Begin>nmake

This is one of the error lines:

*** C:\Program Files\Microsoft Platform SDK\Samples\Begin\Generic *** nmake -nol
ogo /
Start /Wait Hcrtf -o .\XP32_DEBUG\GENERIC.hlp -xn GENERIC.hpj
The system cannot find the file Hcrtf.
NMAKE : fatal error U1077: 'Start' : return code '0x1'
Stop.

I understand that it is critical that the environment variables are correctly set. I used "set" to check my environment variables. This is an edited copy of the result:

Path=C:\Program Files\Microsoft Platform SDK\Bin;C:\Program Files\Microsoft Platform SDK\Bin\WinNT;C:\ProgramFiles\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\
WINDOWS\Microsoft.NET\Framework\v2.0.50215;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;
[... further items not shown]

lib=C:\Program Files\Microsoft Platform SDK\Lib;C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;c:\Program Files\SQLXML 4.0\bin\

INCLUDE=C:\Program Files\Microsoft Platform SDK\Include;C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;

These look okay.

One other thing that concerns me is that the properties of the "...Platform SDK" folder show "size: 904 MB" which is not equal to "size on disk: 938 MB". Does this indicate that it didn't download properly? If it didn't download properly, do I need to uninstall and download again (I hope not, it takes ages on a dial-up line!)?

Regards,
Bruce

P.S. May I also put in a plug for Rex Jaeschke's articles on C++/CLI in CUJ - very informative, with practical examples.

[3822 byte] By [BruceT] at [2008-1-28]
# 1
Looks like you are using the tools from the PSDK.

Thanks,
Ayman Shoukry
VC++ Team

AymanShoukry at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 2
The generic sample has been updated to provide the needed .hlp file. This is because the SDK no longer ships hcrtf. Do you run into trouble if you build another sample, such as begin\sdkdiff?

thank you
barry r. butterklee
Windows SDK Team

This posting is provided "AS IS" with no warranties, and confers no rights.

BarryButterkleeMSFT at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 3
Dear Barry,

Thank you for your response. I'm sorry I'm a bit tardy in replying, but I'm really relieved that someone had a suggestion.

I tried to compile the sample suggested. First I used the Microsoft Visual C++ Toolkit 2003. Before using the "setenv" file, I got this error message:
LINK : fatal error LNK1181: cannot open input file 'ws2_32.lib'
NMAKE : fatal error U1077: 'link' : return code '0x49d'
Stop.
I then ran the "setenv" file, and tried again, and got this message:
Start /Wait Hcrtf -o .\XP32_DEBUG\sdkdiff.hlp -xn sdkdiff.hpj
The system cannot find the file Hcrtf.
NMAKE : fatal error U1077: 'Start' : return code '0x1'
Stop.

I then tried using the Visual C++ Express 2005 Edition Beta 2 command line.
First without running "setenv":
makefile(11) : fatal error U1052: file 'win32.mak' not found
Stop.
Then with "setenv":
The system cannot find the file Hcrtf.
NMAKE : fatal error U1077: 'Start' : return code '0x1'
Stop.

I am a rather recent convert to the joys of computing, so it's probably just my doing something silly. Any further suggestions would be very welcome.
Just as a bit of background, I bought Charles Petzgold's Programming Windows. While I realize that not everyone programs at the Win32 API level, it seems like a great way to get an understanding of some of the processes under the hood. I have to admit I got a bit discouraged after not being able to build the samples, so I haven't taken it further yet, but I may be able to still run programs from within the Express Beta 2 IDE. And, then there is COM, etc. etc. Wow, there's a lot for me to learn!

Regards,
Bruce

BruceT at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 4

Bruce,

Thanks for providing more information. A couple of points
- To build applications for Windows Vista, you should use the compiler and build env that comes with the Windows SDK instead of the Microsoft Visual C++ Toolkit 2003.
- As mentioned earlier, hcrtf.exe is not included in the SDK and any samples that depend upon it have been changed to eliminate that dependency.
- The VS 2005 Express command prompt would not know about SDK headers or libs unless you explicitedly change include and lib search paths in the command prompt prior to building.

thank you
barry r. butterklee
Windows SDK Team

This posting is provided "AS IS" with no warranties, and confers no rights.

BarryButterkleeMSFT at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 5

Dear Barry,

Thank you for your continuing persistence!

Your suggestion that I use the build environment that comes with the Windows SDK appears to very pertinent (why didn't I think of that?!); but I still don't seem to understand what I am doing wrong, so I shall describe exactly what I am doing (I'm a simple kind of fellow).
To set the scene, I am looking at the sample "sdkdiff". I notice that this sample already contains an executable in a folder called XP32_DEBUG (which works fine). There is also an empty folder XP32_RETAIL folder.
I navigate to Start|All Programs|Microsoft Platform SDK for Windows Server 2003 SP1|Open Build Environment Window|Windows XP 32-bit Build Environment|Set Windows 32-bit Build Environment (Retail)

I am now at the command line (by the way, I am using a recent model computer running XP professional). Below, is a copy of what I now enter, and what happens:
Targeting Windows XP 32 RETAIL


C:\Program Files\Microsoft Platform SDK>cd Samples

C:\Program Files\Microsoft Platform SDK\Samples>cd Begin

C:\Program Files\Microsoft Platform SDK\Samples\Begin>cd sdkdiff

C:\Program Files\Microsoft Platform SDK\Samples\Begin\sdkdiff>nmake

Microsoft (R) Program Maintenance Utility Version 7.00.8882
Copyright (C) Microsoft Corp 1988-2000. All rights reserved.

cl -Ox -DNDEBUG -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_
=1 -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0600 -DWIN
VER=0x0501 -D_MT -MT /Fp"XP32_RETAIL\\" /Fo"XP32_RETAIL\\" /Fd"XP32_RETAIL\\"
/Yc"precomp.h" precomp.cpp
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'cl' : return code '0x1'
Stop.

C:\Program Files\Microsoft Platform SDK\Samples\Begin\sdkdiff>

If I enter the same series of actions after "Set Windows 32-bit Build Environment (Debug)", I am back at a familiar "cannot find file Hcrt" error.

Regards,
Bruce

BruceT at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 6
If you like, you can get a copy of Hcrtf.exe. I found this link ftp://ftp.microsoft.com/Softlib/MSLFiles/hcwsetup.exe and ran the exe to install the Microsoft Help Workshop, then went to C:\Program Files\Help Workshop and copied hcrtf.exe and also hwdll.dll (it turns out you need both) into the folder C:\Program Files\Microsoft Visual Studio 8\Common7\Tools. That solved my problem building another of the samples, and it should solve yours.
DevraJ at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 7
It seems that it's the sdkdiff sample which now ships with its help file, not the generic sample. This problem also arises with the fontview sample, C:\Program Files\Microsoft Platform SDK\Samples\Multimedia\Gdi\Fonts\FontView. That help file is not included either.
DevraJ at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 8
Dear Devra J,
I haven't had time to take up your suggestion yet, but I would like to thank you for taking the time to pass on this information.
I am also glad to find that it wasn't just my doing something stupid that led to the problem. It is fairly daunting when I don't understand much about the SDK, but which seems to be well documented and which suggests getting started by building the samples - only to find that the samples don't build as expected.
All the best,
Bruce
BruceT at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 9

Dear Bruce T,

Yeah, really. Last year I couldn't cope with this kind of thing at all. This year I have some coping strategies. Like, if the error message says it's missing a file, I first search my hard drive. If it's there, then I have to find which path has to be altered so that the program can find the file when it needs it. For some of the other samples, I had to use this method to be able to run them. Brian Johnson's instructions said to add "C\ProgramFiles\Microsoft Platform SDK\include" to the Include path, well, for some of the samples, you also had to add "C\Program Files\Microsoft Platform SDK\include\mfc" to the Include path. And if you want to compile them on the command line, you have to add %MSSdk%\Include\mfc to SetEnv.cmd, in the right place.

Anyway, if I can't find the missing file on my hard drive, I search the internet. Most often, someone out there will tell you where to find it.

Devra

DevraJ at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...
# 10

Dear Bruce T,

Also, when you actually build a sample and run it, and go to Help, About, you find that the sample is roughly ten years old, so it seems fair to assume that these samples were created for a much earlier version of the SDK. In other words, if you have a problem, there's a good chance that in some way the sample hasn't survived the transition from the SDK for which it was made to this one, and that it's not your fault.

Devra

DevraJ at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows SDK...

Software Development for Windows Vista

Site Classified