add -pthread to make it work on linux