Add pthread flags for c++ compiler