Adding threading library and -pthread flag to compiler