add -pthread for compiling on linux