At least it compiles! Fixed compiler errors and found I needed -pthread.