title: ubuntu cannot find "gettid" function?
body: <p>I've got a very small program to test thread related stuff:</p>
  
  <pre><code>#include&lt;unistd.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;stdio.h&gt;
  int main()
  {
      pid_t pid=getpid();
      pid_t tid=gettid();
      printf("%d,%d\n",pid,tid);
      return 0;
  }
  </code></pre>
  
  <p>Within vim editor, I focus on 'gettid' and Shift-K, the man page of gettid says it's inside sys/types. No problem, when I compile it, there's error:</p>
  
  <pre><code>g++ mythread.cpp 
  mythread.cpp: In function ‘int main()’:
  mythread.cpp:7:22: error: ‘gettid’ was not declared in this scope
       pid_t tid=gettid();
                    ^
  </code></pre>
  
  <p>I'm on ubuntu1604 with new gcc version. How to fix it?</p>