I am running the following code
cmake_minimum_required(VERSION 3.14)
project(LocksProject)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(lock_example example.cpp)
example.cpp
#include <thread>
#include <iostream>
int main() {
std::jthread {[] {std::cout << "Hi" << std::endl;}};
}
cmake prints
-- The C compiler identification is AppleClang 13.0.0.13000027
-- The CXX compiler identification is AppleClang 13.0.0.13000027
make prints an error:
error: no member named ‘jthread’ in namespace ‘std’
std::jthread {[] {std::cout << “Hi” << std::endl;}};