T
T
tormozillo2021-08-10 13:24:17
C++ / C#
tormozillo, 2021-08-10 13:24:17

C++20 where is jthread located?

I read about the new jthread , I wanted to test it, but the compiler swears that it doesn’t exist. What include is required? 'thread' (in angle brackets) set. I use gcc version 11.1 on Linux, compilation with the g++ test.cpp command

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tormozillo, 2021-08-10
@tormozillo

It is necessary to specify the language standard in the compilation line, the default is not new:
g++ -std=c++20 test.cpp

A
Alexander Ananiev, 2021-08-10
@SaNNy32

Defined in header <thread>
https://en.cppreference.com/w/cpp/thread/jthread

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question