1. Setting up VC++ and the ATL libraries
This step can be skipped if you already have the full version of Visual Studio 2008. Otherwise read on…
Express Edition
First thing to do is to install the free MS C++ Express Edition, you can skip the optional components.
Server® 2003 R2 Platform SDK
Next thing to do is install the Server 2003 R2 SDK which has the necessary ATL headers. You can get away with just these minimal components.
Fixing the errors
Unfortunately there are errors in those headers, or at least in the ones that we need so we must make the following changes.
atlwin.h
At line 1753 you need to add an ‘int’ type specifier as below.
for(int i = 0; i < m_aChainEntry.GetSize(); i++)
atlbase.h
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
Getting them
I tend to think of the WTL of an intrinsic C++ header for Windows development so add it to the Visual Studio paths rather than as an additional include folder in Halites project settings. As such the process described here is the setup I use.
Download the latest headers from it’s WTL SourceForge.net page. You may as well get the latest, v 8.1 as of writing this page.
Installing
Extract the archive somewhere and add the ‘Include’ subfiler from that location to the Visual C++ ‘Include files’ folders list.
At this stage it’s worth opening up one of the samples shipped with the WTL headers amd seeing if it compiles correctly.
3. Install Boost headers
Getting them
Like WTL I add the Boost headers to the VS paths.
Once the headers are to be found on Boost SourceForge.net. The latest as of now is v1.40 though v1.41 should be out by end of the month I believe.
To build the libraries you need the bjam executable which you may as well download though it can be built from the source archive. Put that in the library folder.
Building
Now open the file
boost_1_40_0\tools\build\v2\user-config.jam
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 command prompt and naviagate to the boost folder and run the following 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 crucial. The new VS 2008 ‘safe’ standard library is not compatible with the ‘non-safe’ version. Since the Halite project builds against the ‘non-safe’ version so too must your Boost libraries.
Installing
With the libraries compiled successfully add the root boost headers folder to the VS ‘Include files’ folders and the ‘libx86\libs’ subfolder to the ‘Libraries files’ folders.
4. Build Halite
Getting the Halite sources
For the purposes of this guide get the latest shipped source archive from the Halite sf.net project page. Extract the archive somewhere, it contains the libtorrent, Loki, STLSoft and OpenSSL versions used to build that particular release.
Getting the OpenSSL binaries
OpenSSL is a bit of a pain to compile. First you need to install Perl which is not really a hassle thanks to Strawberry Perl, but you do then also need to modify the make file to build against the correct runtime libraries.
Personally I just recommend downloading the binaries I host also on the Halite sf.net project page. Get the most recent release and Halite should build without issues. Extract the archive into the ‘lib/openssl’ folder within the Halite source archive.
Building Halite
This should also be an easy step if everything up to now has been done correctly. Here is what my VS directories look like now.
So just load the project files, ignore the WiX warning for the time being and click build.
Note because of a limitation in the older ATL 3.0 headers shipped with the Server 2003 R2 SDK your build of Halite will not be able to use different language DLLs. One function is missing from those older headers and it just is not worth trying to develop a workaround when I myself use the full version of Visual Studio 2008.

