Home > Back-end >  C wrote in the main function to create multithreaded statement after unable to enter the main functi
C wrote in the main function to create multithreaded statement after unable to enter the main functi

Time:10-06

#include
#include

using namespace std;

Void fun1 ()
{
cout <& lt; "Hello" & lt; }

Int main ()
{
Fun1 ();
Thread t (fun1);
T.j oin ();
return 0;
}

No error, the debug flash back, look for a long time really don't know how to solve, bosses, come on for advice

CodePudding user response:

I written in the VScode, the compiler is mingw - posix

CodePudding user response:

A compiler can?
Isn't it a little bit of c + + 11 compiler options, try to check

CodePudding user response:

refer to the second floor of cattle bucai response:
compile a can?
Isn't it a little bit of c + + 11 compiler options, check to try


I changed the Cygwin, minGW seems to be less, can run after changed

CodePudding user response:

The universe vs compiler, version VS2017 said there is no problem, normal operation,

CodePudding user response:

reference 4 floor ggglivw response:
compiler vs, universe version VS2017 said there is no problem, run normally,


Function is too much, not suitable for our small white, ha ha

CodePudding user response:

Solution to write here, let's kangkang
https://blog.csdn.net/weixin_42611695/article/details/104796167
  • Related