this commit contains a few C++ changes to get
"make check" and "exmaples/make" work
 on my Ubuntu 12.04 / g++4.6.3.

I have also tested it with MacOS 10.9