Fixed building on Macintosh and Linux

Now builds on OS X (tested on 10.9.3 with Xcode 5.1.1 and clang-503.0.40) and Linux (tested on Fedora 20 (3.14.4-200.fc20.i686) with gcc 4.9.0).