fork(1) download
  1. #include <iostream>
  2. #include <thread>
  3.  
  4. int main() {
  5. using std::thread;
  6. using std::cout;
  7. using std::endl;
  8.  
  9. thread th([](){cout << "Hello from other thread" <<endl;});
  10.  
  11. cout << "Hello from main thread" << endl;
  12. th.join();
  13.  
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/LJsRmU/ccwt9alT.o: In function `main':
prog.cpp:(.text.startup+0x8): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty