Question: why does my code still have 4 errors in the ( int main ) section and will not run in eclipse? #include #include using namespace

why does my code still have 4 errors in the (int main) section and will not run in eclipse?
#include
#include
using namespace std;
void countUp(){
int i;
for(i =0; i <=20; i++){
cout << i << endl;
}
}
void countDown(){
int i;
for(i =19; i >=0; i--){
cout << i << endl;
}
}
int main(){
thread countUpThread(countUp);
countUpThread.join();
thread countDownThread(countDown);
countDownThread.join();
return 0;
}
here are the errors that I keep getting
..\src\Module7Porfolio.cpp:27:4: error: 'thread' was not declared in this scope
thread countUpThread(countUp);
^~~~~~
..\src\Module7Porfolio.cpp:28:4: error: 'countUpThread' was not declared in this scope
countUpThread.join();
^~~~~~~~~~~~~
..\src\Module7Porfolio.cpp:29:11: error: expected ';' before 'countDownThread'
thread countDownThread(countDown);
^~~~~~~~~~~~~~~
..\src\Module7Porfolio.cpp:30:4: error: 'countDownThread' was not declared in this scope
countDownThread.join();
^~~~~~~~~~~~~~~
14:50:14 Build Failed. 4 errors, 0 warnings. (took 826ms)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!