Just a few days ago, Microsoft released free set of development
tools, the Microsoft
Visual C++ Toolkit 2003. (As always, don’t be surprised if the
link is broken. Even Microsoft’s own web pages often have broken
internal links, thanks to Microsoft’s inexplicable compulsion to
move their pages again and again and again, and never
leave pointers behind. Google should be able
to find it, though.)
This free toolkit contains Microsoft’s latest version of Visual C++,
and seems to be fully functional. I was a C programmer in the ’80s and
early ’90s, and I would have been thrilled with this product. And
now it’s free! I guess it makes good sense; Microsoft knows
professional C/C++ programmers are going to insist on the Visual
Studio development environment, not just these command line tools,
so they aren’t going to lose any sales. And maybe some users of the
free tools will later move up to the full product. Even if they
don’t, the more people develop for Windows, the better it is for
Microsoft.
But even though I can see that this is good for Microsoft, I’m still
grateful, because it’s very good for me and lots of people like me.
I don’t program in C any more (except for tiny little one-off
programs once in a blue moon), but I do want to be able to build
open source C programs I download. For example, installing some
Perl modules requires having a C compiler. Up until now, if I wanted
any of those modules (such as the various SSL libraries that
ActiveState doesn’t make available in binary form), I had to use
Cygwin’s Perl and Gnu C compiler. Those work fine, but Cygwin isn’t
Windows. Sometimes I wanted to write Windows-specific Perl programs
that needed modules like that, and I was out of luck. I just
couldn’t see buying Visual Studio for such a small need.
Can this free tool meet that need? I put it to a real test: building
Perl for Windows from source. That’s a pretty stringent test of a
command line C development environment, and it includes an extensive
test suite so I can tell for sure whether the build worked perfectly
or not.
The free tools met the test. I have my own build of Perl now, and
I can use the full power of CPAN to add to it. However, the
Microsoft
Visual C++ Toolkit 2003 wasn’t enough by itself to do the job.
I needed to install some other free development tools from
Microsoft to get all the things I needed:
- Microsoft
Windows Platform SDK. You have to install this from within
Internet Explorer, and select how much of the SDK to install. I
chose everything, and started to regret it because it
was about 250MB. But when I looked more closely, I saw that the
“core” of the SDK was about 80% of the whole thing, so I wouldn’t
have saved much by trimming it down. This includes all the
Windows libraries and include files so you can write platform
specific programs. - Microsoft
.NET Framework SDK Version 1.1. This includes the essential
msvcrt.lib library file, which a lot of programs need. It also
has the essential nmake utility to build complex programs. - Microsoft
.NET Framework Version 1.1 Redistributable Package. The .NET
Framework SDK says you have to install this first.
Once you’ve installed all of the above, you’re ready to start programming.
At least, provided you’re willing to fix your PATH, LIB, and INCLUDE
environment variables every time you try to use them. I fixed them
once and for all in the “Environment Variables” section of the “Advanced”
tab of “My Computer” properties. Here are the values you need to
add to them (I’m assuming that you chose the default installation
locations for each tool):
- INCLUDE
- Add C:\Program Files\Microsoft SDK\Include\;c:\Program
Files\Microsoft Visual C++ Toolkit 2003\include;c:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\include; to
the value of this variable (or create the variable if needed). - LIB
- Add C:\Program Files\Microsoft SDK\lib\;c:\Program
Files\Microsoft Visual C++ Toolkit 2003\lib;c:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\lib; to
the value. - PATH
- Add C:\Program Files\Microsoft Visual C++ Toolkit
2003\bin;C:\Program Files\Microsoft SDK\Bin\.;C:\Program
Files\Microsoft SDK\Bin\WinNT\;C:\Program
Files\Microsoft.NET\SDK\v1.1\Bin;c:\Program Files\Microsoft
SDK\Bin\Win64; to the path.
Next time: actually building Perl with this.
And now I’m off to try to build Apache.