0

So I started to learn c++ and I come across multithreading, but there is one problem: It gives me the error main.cpp|12|error: 'thread' was not declared in this scope although I have included the <thread> library in my code. I use Code::Blocks and GNU GCC Complier on Windows. Here is an example of my code:

#include <iostream>
#include <thread>
using namespace std;

void test(){
    cout<<"hello, I am a thread !";
}

int main(){

thread t1(test);

return 0;
}
Costel biju
  • 125
  • 1
  • 2
  • 6
  • Not the solution to the problem you describe, but you need to `t1.join()` before it's destroyed. – François Andrieux Nov 29 '18 at 19:38
  • 1
    Why are you using "Code::Blocks and GNU GCC Complier on Windows." when MSVC is available free of charge for educational purposes? Microsoft IDE way surpasses CodeBlocks – SergeyA Nov 29 '18 at 19:43

0 Answers0