Installing the latest version of Boost C++ from source on Windows for use in Visual C++ in 5 simple steps

by APIJunkie 23. January 2012 06:38

If you wish to use the latest Boost C++ libraries in your Visual C++ projects and the automated Boost installers at: are not up to date, crashing (happened to me) or you just want to build them yourself,  you can follow a few simple steps to get the job done.

1. Download the latest version of Boost from:

The direct link for the current version (1.48.0) can be found at:

 2.  Extract the compressed file to a directory of your choice

Example: C:\SrcLibs\ boost_1_48_0

 3. Open a command prompt in the directory you created in step 2.

Example: C:\SrcLibs\ boost_1_48_0

 4. Type the following 2 commands at the command prompt:



 The above commands will configure and build the Boost libraries from source.

 It will take some time to build the libraries depending on your hardware.

 If all has gone well you should see a message along the lines of:

 The Boost C++ Libraries were successfully built!

 The following directory should be added to compiler include paths:

     C:\SrcLibs\ boost_1_48_0

 The following directory should be added to linker library paths:

     C:\SrcLibs\ boost_1_48_0\stage\lib

 5.  Add the Boost include and library path to a Visual C++ project

For example in Visual Studio 2010:

Create a new C++ console application

Go to Project/Properties/Configuration Properties/VC++ Directories/

Set Include Directories to:

C:\SrcLibs\ boost_1_48_0;$(IncludePath)

 Set Library Directories to:

C:\SrcLibs\ boost_1_48_0\stage\lib;$(LibraryPath)

That’s it; you can start writing code that uses Boost…





C++ | How To | Visual Studio | Boost

VS 2010 native code static linking

by APIJunkie 18. May 2011 06:36

This is a heads up for any one that is used to auto link static libraries using project dependencies.

VS 2010 changed the game by adding a new step that is necessary in order to auto link static libraries.

It is not enough to specify project dependencies as we used to do in older versions of Visual Studio.

To setup auto linking go to Project/Properties/Common Properties/Framework and References/Add new reference.


C | C++ | Static | Tips and Tricks | Troubleshoot | Visual Studio

How to develop native apps on VS 2010 targeting Win 2K and older Windows versions

by APIJunkie 24. March 2011 03:41

By default when developing native C/C++ apps using VS 2010 beware that your executables will not run on Win 2K and older targets.

That is true even if you remove any external dependencies and adhere to Win32 API compatible with older Windows versions.

One possible solution to the problem is Native Multi Targeting - using the VS 2008 compiler while working with the VS 2010 IDE. Assuming you can afford to have VS 2008 installed on the same machine.



C | C++ | How To | Tips and Tricks | Visual Studio

Running multiple commands on a Visual Studio post-build event using batch files

by APIJunkie 31. January 2010 11:13

 Many times it’s more desirable to collect your post build commands into batch files. Some of the reasons include easier maintenance, portability and satisfying the “don’t repeat principle” when multiple projects are sharing the same commands. If you do decide to go down the batch road there are a couple of things you should be aware of:

1.       If you want to run multiple batch files or commands. You will need to use the “call” command to ensure that all the other commands execute. If you don’t do that only the first batch file will run. To use the call command, simply precede each batch file name with “call”.


Instead of writing:



call C:\MyBatchFile.bat


2.       Sometimes you will need to run external programs that could be installed in different locations on different dev machines. In such cases you might find the batch “start” command very useful. Instead of specifying the path, you just use the external program name or its file associations.


Let’s say you have several developers that have installed Winrar in different locations.

Writing: “C:\XXX\Winrar.exe” in the batch will not work in cases where developers installed it on another drive or location.

But writing: “start winrar” in the batch will work if it’s installed on the developer’s machine.

 Hope this helps!


.NET | Visual Studio | Portability

Step by step on how to upgrade Silverlight 2 beta 2 to Silverlight 2 RC0

by APIJunkie 3. October 2008 22:30

Since I had to do this a couple of times on different machines I thought this might be useful for others.

Here is the list of steps I take to upgrade a Silverlight 2 beta 2 development machine to Silverlight 2 RC0.

First the pre requisites:

0.0 Because Blend version 2 can't live happily with older preview versions, you will need to uninstall Blend 2.5 June Preview or any other version of Blend 2 preview you may have on the machine.

0.1. You will need Visual Studio 2008 SP1 and .Net 3.5 SP1, so if you haven't done so before, install Visual Studio 2008 SP1(this will install .NET 3.5 SP1 as well).

Now the actual installation steps:

1. Install Microsoft Silverlight Tools for Visual Studio 2008 SP1(this will uninstall Silverlight 2 beta 2 SDK if need be...)

2. Install Blend 2 or Blend 2 trial version.

3. Install Blend 2 Service Pack 1 Preview.

You should be good to go.

Regarding breaking changes here are a couple we encountered:

1. The DataGridTextColumn property DisplayMemberBinding has been renamed to Binding.

2. TextAlignment was removed from button styles.

Good luck!


Silverlight | Visual Studio | Blend

How to fix the Visual Studio 2005 Pro installation error (April 2007 MSDN)

by APIJunkie 15. December 2007 07:13

For those of you who tried to install VS 2005 and were met with the dreaded htmllite.dll file missing message. You should know that it is not the media fault or your fault it is just an annoying bug in the installation code. The bug seems to be related to the naming of the media and location of the files.

Here is one simple solution that solved the problem for us:

1. Create a new directory on the machine you want to install VS 2005 (for example: D:\VS2005).

2. Copy the contents of [DVD Drive]\English\VS2005Pro\Disk2 into D:\VS2005(this is not a mistake copy files in disk 2 first!!!).

3. Copy the contents of [DVD Drive]\English\VS2005Pro\DISK1 into D:\VS2005(when prompted, answer yes to all, to overwrite all duplicate files).

4. Go to D:\VS2005 and run Setup.exe.

You should be good to go. Just remember to install VS 2005 service pack 1 and check for Microsoft updates after your done.



Visual Studio

Little Endian, Big Endian and C/C++ Bit Fields

by APIJunkie 11. December 2007 03:10

People working with cross platform low level code are usually aware of the issues related to the little and big endian data presentation methods which dictate how bytes are ordered in memory. This helps them avoid pitfalls related to cross platform data transfer such as when transferring data over the network or when moving files from a little endian platform to a big endian platform and vice versa.

But what about bit field ordering, is there any standard ordering of C/C++ bit-fields and what effect can this have on your code?

As it turns out there is no ANSI bit ordering standard and bit ordering is compiler dependant.

To demonstrate the problems that might arise from this lack of standardization, consider the following C++ code that describes an IP packet header:

struct IPHeader


unsigned int version:4; // version of IP

unsigned int headerLen:4; // length of IP header

unsigned char tos; // type of service

unsigned short totalLen; // total length of the packet

unsigned short id; // unique identifier

unsigned short flags; // flags

unsigned char ttl; // time to live

unsigned char protocol; // protocol  type (TCP, UDP etc)

unsigned short checksum; // IP checksum

unsigned int sourceIP; // source IP address

unsigned int destIP; // destination  IP address


The IP header length and version fields are both 4 bit, bit-fields.

Logic might lead you to assume that the header length will be placed after the version in memory like the other IPHeader data members but in fact this is compiler dependant.

For example Visual C++ documentation says the following about Microsoft's implementation of C++ bit fields:

"The ordering of data declared as bit fields is from low to high bit..."

The result of this would be that length will be placed before the version field and this will produce an invalid IP header.

This means that for the IP header to be generated correctly on Visual C++ you will need to reverse the order of the IP header length and version fields:

struct IPHeader


unsigned int headerLen:4; // length of IP header

unsigned int version:4; // version of IP

unsigned char tos; // type of service

unsigned short totalLen; // total length of the packet

unsigned short id; // unique identifier

unsigned short flags; // flags

unsigned char ttl; // time to live

unsigned char protocol; // protocol  type (TCP, UDP etc)

unsigned short checksum; // IP checksum

unsigned int sourceIP; // source IP address

unsigned int destIP; // destination  IP address


To avoid those types of pit falls when working with bit fields, make sure you know and control the type of bit ordering your compiler and data structures employ.

Some compilers might let you change the default bit ordering but be sure to consider all the possible interactions with other parts of the code.


C++ | Visual Studio | C

Fix for Silverlight 1.1 Tools Alpha for Visual Studio 2008 Package Load Failure

by APIJunkie 26. November 2007 23:15

Microsoft recently released Visual Studio 2008. Unfortunately those of us who have been waiting for Silverlight integration with the release version of VS 2008 were in for a bad surprise.

The following message appeared when trying to create a new Silverlight project:

"Package Load Failure

Package 'Microsoft.VisualStudio.Silverlight.SLPackage, Microsoft.VisualStudio.Silverlight, Version=,..."

The reason was that the old version of Silverlight 1.1 Tools Alpha was not compatible with the release version of VS 2008.

The good news is that Microsoft fixed this issue yesterday and released a new version of Silverlight 1.1 Tools Alpha for Visual Studio 2008.

One important thing to note is that  when I installed the new version it failed so I had to run uninstall first and then reinstall the new version to fix the problem.



.NET | Silverlight | Visual Studio

About the author

Name of author

I was first wounded by x86 assembly, recovered and moved on to C. Following a long addiction to C++ and a short stint at rehab I decided to switch to a healthier addiction so I am now happily sniffing .NET and getting hooked on Silverlight.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

  James Bacon