Mac下vscode无法创建C++有参函数的线程

Mac下使用clion可以创建完成,但是使用vscode就不行,我vacodeC++是用cmake,请问是需要加什么东西吗?

CmakeLists.txt如下:

cmake_minimum_required(VERSION 3.17)

project(duo)
set(CMAKE_CXX_STANDARD 14)

SET(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")   

include_directories(include)
aux_source_directory(./src SRC_FILES)

add_executable(main main.cpp ${SRC_FILES})
target_link_libraries(main PUBLIC pthread)

launch.json


{
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(lldb) 启动",
                "type": "lldb",
                "request": "launch",
                "program": "${workspaceFolder}/build/main",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false,
                "MIMode": "lldb",
                "preLaunchTask": "Build",
            }
        ]
    }

task.json


{
        "version": "2.0.0",
        "options": {
            "cwd": "${workspaceFolder}/build"
        },
        "tasks": [
            {
                "type": "shell",
                "label": "cmake",
                "command": "cmake",
                "args": [
                    ".."
                ]
            },
            {
                "label": "make",
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "command": "make",
                "args": []
            },
            {
                "label": "Build",
                "dependsOrder": "sequence",
                "dependsOn": [
                    "cmake",
                    "make",
                ]
            }
        ]
    }

main.cpp

#include <iostream>
#include <thread>
using namespace std;

void fd(int &i)
{
    std::cout << "hello world" << i;
}

int main()
{
    int i = 1;
    thread t(fd, i);
    t.join(); // 等待新起的线程退出
}

报错如下

Consolidate compiler generated dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
clang: warning: -lpthread: 'linker' input unused [-Wunused-command-line-argument]
In file included from /Users/cjy/Projects/C++/duo/main.cpp:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/thread:287:5: error: attempt to use a deleted function
    _VSTD::__invoke(_VSTD::move(_VSTD::get<1>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__config:858:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/thread:298:12: note: in instantiation of function template specialization 'std::__thread_execute<std::unique_ptr<std::__thread_struct>, void (*)(int &), int, 2UL>' requested here
    _VSTD::__thread_execute(*__p.get(), _Index());
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/thread:314:54: note: in instantiation of function template specialization 'std::__thread_proxy<std::tuple<std::unique_ptr<std::__thread_struct>, void (*)(int &), int>>' requested here
    int __ec = _VSTD::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
                                                     ^
/Users/cjy/Projects/C++/duo/main.cpp:13:12: note: in instantiation of function template specialization 'std::thread::thread<void (&)(int &), int &, void>' requested here
    thread t(fd, i);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/type_traits:1957:5: note: '~__nat' has been explicitly marked deleted here
    ~__nat() = delete;
    ^
1 error generated.
make[2]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
终端进程“make”已终止,退出代码: 2