Fix compile error under mac

Now it can compile and run on mac os,as like linux.
You can compile by make