Changed build directory.
Fixed compilation warnings and errors

I thought that this comparison of signed and unsigned ints was some kind of ISO standard feature
(see "[expr] 5.10 usual arithmetic conversions") but it was simply g++4.6 bug! g++4.8 reports it
correctly as warning.