Fix compile errors (tested on Mac OSX)

Some obvious fixes to make project build on Mac OSX environment. Besides, there are still some other issues need to be fixed (properly link libraries).

P. S. It's my first pull request :)