Building with VS 2008

1. Set­ting up VC++ and the ATL libraries

This step can be skipped if you already have the full ver­sion of Visual Stu­dio 2008. Oth­er­wise read on…

Express Edi­tion

First thing to do is to install the free MS C++ Express Edi­tion, you can skip the optional components.

Server® 2003 R2 Plat­form SDK

Next thing to do is install the Server 2003 R2 SDK which has the neces­sary ATL head­ers. You can get away with just these min­imal components.


Fix­ing the errors

Unfor­tu­nately there are errors in those head­ers, or at least in the ones that we need so we must make the fol­low­ing changes.


At line 1753 you need to add an ‘int’ type spe­cifier as below.

for(int i = 0; i < m_aChainEntry.GetSize(); i++)


At about line 287 of ‘atlbase.h’ make this change-

/* Comment it
PVOID __stdcall __AllocStdCallThunk(VOID);
VOID __stdcall __FreeStdCallThunk(PVOID);

#define AllocStdCallThunk() __AllocStdCallThunk()
#define FreeStdCallThunk(p) __FreeStdCallThunk(p)

#pragma comment(lib, "atlthunk.lib")

#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(), 0, sizeof(_stdcallthunk))
#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)

Credit to this guide for these fixes.

2. Installing WTL headers

Get­ting them

I tend to think of the WTL of an intrinsic C++ header for Win­dows devel­op­ment so add it to the Visual Stu­dio paths rather than as an addi­tional include folder in Hal­ites pro­ject set­tings. As such the pro­cess described here is the setup I use.

Down­load the latest head­ers from it’s WTL page. You may as well get the latest, v 8.1 as of writ­ing this page.


Extract the archive some­where and add the ‘Include’ sub­filer from that loc­a­tion to the Visual C++ ‘Include files’ folders list.

At this stage it’s worth open­ing up one of the samples shipped with the WTL head­ers amd see­ing if it com­piles correctly.

3. Install Boost headers

Get­ting them

Like WTL I add the Boost head­ers to the VS paths.

Once the head­ers are to be found on Boost The latest as of now is v1.40 though v1.41 should be out by end of the month I believe.

To build the lib­rar­ies you need the bjam execut­able which you may as well down­load though it can be built from the source archive. Put that in the lib­rary folder.


Now open the file


and at about line 57 and declare you’re using VS 2008, i.e. v 9.0

# Configure specific msvc version (searched for in standard locations and PATH)
using msvc : 9.0 ;

Next open a com­mand prompt and naviagate to the boost folder and run the fol­low­ing command

bjam --toolset=msvc-9.0 --build-type=complete --stagedir=libx86 define=_HAS_ITERATOR_DEBUGGING=0 define=_SECURE_SCL=0 define=_CRT_SECURE_NO_DEPRECATE define=_SCL_SECURE_NO_DEPRECATE define=_CRT_SECURE_NO_WARNINGS asynch-exceptions=on stage

and wait patiently, very patiently.

NOTE the defines here are cru­cial. The new VS 2008 ‘safe’ stand­ard lib­rary is not com­pat­ible with the ‘non-safe’ ver­sion. Since the Hal­ite pro­ject builds against the ‘non-safe’ ver­sion so too must your Boost libraries.


With the lib­rar­ies com­piled suc­cess­fully add the root boost head­ers folder to the VS ‘Include files’ folders and the ‘libx86\libs’ sub­folder to the ‘Lib­rar­ies files’ folders.

4. Build Halite

Get­ting the Hal­ite sources

For the pur­poses of this guide get the latest shipped source archive from the Hal­ite pro­ject page. Extract the archive some­where, it con­tains the lib­t­or­rent, Loki, STLSoft and OpenSSL ver­sions used to build that par­tic­u­lar release.

Get­ting the OpenSSL binaries

OpenSSL is a bit of a pain to com­pile. First you need to install Perl which is not really a hassle thanks to Straw­berry Perl, but you do then also need to modify the make file to build against the cor­rect runtime libraries.

Per­son­ally I just recom­mend down­load­ing the bin­ar­ies I host also on the Hal­ite pro­ject page. Get the most recent release and Hal­ite should build without issues. Extract the archive into the ‘lib/openssl’ folder within the Hal­ite source archive.

Build­ing Halite

This should also be an easy step if everything up to now has been done cor­rectly. Here is what my VS dir­ect­or­ies look like now.


So just load the pro­ject files, ignore the WiX warn­ing for the time being and click build.

Note because of a lim­it­a­tion in the older ATL 3.0 head­ers shipped with the Server 2003 R2 SDK your build of Hal­ite will not be able to use dif­fer­ent lan­guage DLLs. One func­tion is miss­ing from those older head­ers and it just is not worth try­ing to develop a work­around when I myself use the full ver­sion of Visual Stu­dio 2008.

Server 2003 SP1

If you think this is worthy, why not share it?