#include <iostream>
#include <thread>
void hi()
{
std::cout<<"hi"<<std::endl;
}
int main()
{
std::thread t1(hi);
t1.join();
}
I turned on C++ to study threads, but as soon as I started it, the following error occurred. The error only occurs when building with 64-bit debug. And the error is thrown when the main method exits. What's the problem?
video link: https://www.youtube.com/watch?v=cM6OJ5NgBMQ
Translated into English, the exception that occurred is as follows.
Exception thrown (0x00007FF670271350, test.exe): 0xC0000005: 0x0000000000006800 Access violation while writing location.