In 2004, Microsoft published Visual C++ Toolkit 2003 - full version of Visual C++ 2003 optimizing compiler (version 1310) available free of charge. It was the first free, good and almost complete implementation of C++ programming language by Microsoft. It is quite old but still used by many developers.
The Toolkit is fairly complete, but you can not avoid a few hacks if you want to use it :-) So, I’ve decided to collect them all in one place to help building projects like GEOS, libLAS or GDAL/OGR with the Visual C++ Toolkit 2003.
First, installation of the following packages is required:
- Microsoft .NET Framework SDK 1.1
- Microsoft Platform SDK for Windows Server 2003 R2
- Microsoft Visual C++ Toolkit 2003 (no longer available from Microsoft website, just be persistent cuiling for it)
This is list of hacks like installation of missing components and fixing a project makefiles:
- The .NET Framework SDK 1.1 installation (listed above) is required in order to get C Run-Time libraries installed: msvcrt.lib and msvcrtd.lib. The .NET SDK installer will copy these files (and a few other components) to directories located in:
C:\Program Files\Microsoft Visual Studio .NET 2003
- Surprisingly, import library for C++ Run-Time Library msvcp71.dll is not included in the Visual C++ Toolkit 2003 distribution. Missing files can be downloaded from CERN server: msvcprt.lib and msvcprt.def. Copy them into
C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib
- The Toolkit does not include lib.exe utility - Microsoft Library Manager. Fortunately, lib.exe is just a simple wrapper on Microsoft Incremental Linker - link.exe. So, in your NMAKE makefiles replace lib.exe (or lib) command with:
Most of articles about Visual C++ Toolkit 2003 and Platform SDK installation procedure suggest to permanently update environment variables like INCLUDE, LIB and PATH. Personally, I don’t like this approach. Instead, I write a simple _SETMSVC71.BAT script which I execute in console window before I run NMAKE to build a software project using Visual C++ Toolkit 2003.
The script I use consists of three commands:
@echo off CALL "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd" CALL "C:\Program Files\Microsoft Visual C++ Toolkit 2003\vcvars32.bat" CALL "C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\sdkvars.bat"
Copy this script to location that is available from the PATH.
Sample build - libLAS
Below, a few simple steps are presented of using Visual C++ Toolkit 2003 and environment configured as presented above to build libLAS project. The same procedure should work for projects like GEOS or GDAL/OGR.
- Run Command Prompt (cmd.exe)
- Configure environment by executing _SETMSVC71.BAT script:
Check if basic commands are available: cl.exe, nmake.exe, link.exe.
- Go to libLAS source code directory:
C:\> cd dev\liblas\trunk
- Run NMAKE command to build libLAS library and utilities:
C:\dev\liblas\trunk> nmake /f makefile.vc