Added gcc flag -pthread to build correctly