Edited to compile on Linux.  (tested on Ubuntu 12.04)