I am new to multithreading but I found an answer in this site about simple multithreading code. I copied it exactly with #include <thread> but later it says in the terminal (I am running Visual Studio Code) that I have not included thread. Here is the code.
#include <string>
#include <iostream>
#include <thread>
using namespace std;
void task1(string msg)
{
    cout << "task1 says: " << msg;
}
int main()
{
    thread t1(task1, "Hello");
    t1.join();
}
This is the error I see:
c:\Users\Lol\Desktop\C++\Thread testing\Threadtest.cpp: In function 'int main()':
c:\Users\Lol\Desktop\C++\Thread testing\Threadtest.cpp:18:5: error: 'thread' was not declared in this scope
   18 |     thread t1(task1, "Hello");
      |     ^~~~~~
c:\Users\Lol\Desktop\C++\Thread testing\Threadtest.cpp:5:1: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
    4 | #include <thread>
  +++ |+#include <thread>
    5 |
c:\Users\Lol\Desktop\C++\Thread testing\Threadtest.cpp:24:5: error: 't1' was not declared in this scope; did you mean 'tm'?
   24 |     t1.join();
      |     ^~
      |     tm
The terminal process terminated with exit code: 1
 
    