fork download
  1. #include <thread>
  2. #include <iostream>
  3. #include <pthread.h>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. thread t1;
  10.  
  11. cout << t1.get_id() << endl;
  12. pthread_setname_np( t1.native_handle(), "thread1");
  13. cout << t1.get_id() << endl;
  14.  
  15. return 0;
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/23c0Or/ccjHG8kq.o: In function `main':
prog.cpp:(.text.startup+0x35): undefined reference to `pthread_setname_np'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty