title: Timespec redefinition error
body: <p>While executing a Pthread program in C using Visual Studio 2015, I got the following error:</p>
  
  <pre><code>Error C2011 'timespec': 'struct' type redefinition
  </code></pre>
  
  <p>The following is my code:</p>
  
  <pre><code>#include&lt;pthread.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;stdio.h&gt;
  
  
  void *calculator(void *parameter);
  
  int main(/*int *argc,char *argv[]*/)
  {
      pthread_t thread_obj;
      pthread_attr_t thread_attr;
      char *First_string = "abc"/*argv[1]*/;
      pthread_attr_init(&amp;thread_attr);
          pthread_create(&amp;thread_obj,&amp;thread_attr,calculator,First_string);
  
  }
  void *calculator(void *parameter)
  {
      int x=atoi((char*)parameter);
      printf("x=%d", x);
  }
  </code></pre>
  
  <p>The <code>pthread.h</code> header file contains the following code related to timespec:</p>
  
  <pre><code>#if !defined(HAVE_STRUCT_TIMESPEC)
  #define HAVE_STRUCT_TIMESPEC
  #if !defined(_TIMESPEC_DEFINED)
  #define _TIMESPEC_DEFINED
  struct timespec {
          time_t tv_sec;
          long tv_nsec;
  };
  #endif /* _TIMESPEC_DEFINED */
  #endif /* HAVE_STRUCT_TIMESPEC */
  </code></pre>
  
  <p>No other header file which I use uses the <code>timespec</code> struct, so there is no chance of redefining. There is no chance of a corrupted header file because it has been downloaded from pthread opensource website.</p>