Fix compilation errors under cpp