Add -pthread to the linker command line too