title: pthread support in visual studio 2013
body: <p>I downloaded pre-build library from <a href="http://sourceforge.net/projects/pthreads4w/files/latest/download?source=typ_redirect" rel="nofollow">http://sourceforge.net/projects/pthreads4w/files/latest/download?source=typ_redirect</a>.</p>
  
  <p>I extracted it to the following directory:
  C:\Users\Veena\Documents\pthread\pthreads-w32-2-9-1-release</p>
  
  <p>I set following things:
  In projects -> right click -> properties -> configuration properties -> C/C++ -> General -> Additional include directories -> "C:\Users\Veena\Documents\pthread\pthreads-w32-2-9-1-release\Pre-built.2\include"</p>
  
  <p>In projects -> right click -> properties -> configuration properties -> linker -> General -> Additional library directories -> "C:\Users\Veena\Documents\pthread\pthreads-w32-2-9-1-release\Pre-built.2\lib\x86"</p>
  
  <p>In projects -> right click -> properties -> configuration properties -> linker -> Input -> Additional dependencies -> 
  pthreadVC2.lib 
  pthreadVCE2.lib 
  pthreadVSE2.lib </p>
  
  <p>In projects -> right click -> properties -> configuration properties -> linker -> All options -> Additional options -> 
  -lpthread</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include "stdafx.h"
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;pthread.h&gt;
  
  struct Node {
      int data;
      struct Node* next;
  };
  
  struct Node*head;
  pthread_rwlock_t rwlock;
  int numThreads;
  
  int i, j;
  float mInsert, mDelete, mMember;
  int data[1000];
  int test[10000];
  long numberOfTotalOperations = 10000;
  long numberOfInsertOperations;
  long numberOfDeleteOperations;
  long numberOfMemberOperations;
  
  void *Process(void* rank);
  int Member(int val);
  int Insert(int val);
  int Delete(int val);
  long getCurrentTime(void);
  
  int main(int argc, char* argv[]) {
  
      if (argc != 5) {
          printf("&lt;member op fraction&gt; &lt;insert op fraction&gt; &lt;delete op fraction&gt;");
          exit(0);
      }
      mMember = strtod(argv[1], NULL);
      mInsert = strtod(argv[2], NULL);
      mDelete = strtod(argv[3], NULL);
      numThreads = strtod(argv[4], NULL);
  
      numberOfInsertOperations = mInsert * numberOfTotalOperations;
      numberOfDeleteOperations = mDelete * numberOfTotalOperations;
      numberOfMemberOperations = mMember * numberOfTotalOperations;
  
      pthread_rwlock_init(&amp;rwlock, NULL);
  
      //data set : create with non-repeated random number
      for (i = 0; i &lt; 1000; i++) {
          while (1) {
              int temp = rand() % 65536;
              int found = 0;
              for (j = 0; j &lt; i; j++) {
                  if (data[j] == temp) { found = 1; break; }
              }
              if (found == 0) { data[i] = temp; break; }
          }
      }
      //test set
      for (i = 0; i &lt; 10000; i++) {
          while (1) {
              int temp = rand() % 65536;
              int found = 0;
              for (j = 0; j &lt; i; j++) {
                  if (test[j] == temp) { found = 1; break; }
              }
              if (found == 0) { test[i] = temp; break; }
          }
      }
  
      //----------------------------------------- Insert,Delete,Member
      long thread;
      pthread_t* thread_handles;
      thread_handles = malloc(numThreads * sizeof(pthread_t));
  
      for (thread = 0; thread &lt; numThreads; thread++)
          pthread_create(&amp;thread_handles[thread], NULL, Process, (void*)thread);
  
      for (thread = 0; thread &lt; numThreads; thread++)
          pthread_join(thread_handles[thread], NULL);
  
  
      //--------
      free(thread_handles);
      return 0;
  }
  
  void *Process(void* rank) {
  
      long my_rank = (long)rank;
      int i, offset = (numberOfTotalOperations * my_rank) / numThreads;
      int my_last_i = offset + (numberOfTotalOperations / numThreads);
      long insert_op = numberOfInsertOperations / numThreads;
      long delete_op = numberOfDeleteOperations / numThreads;
      long member_op = numberOfMemberOperations / numThreads;
  
      for (i = offset; i &lt; my_last_i; i++) {
          if (i &lt; offset + insert_op) {   //insert
              pthread_rwlock_wrlock(&amp;rwlock);
              Insert(test[i]);
              pthread_rwlock_unlock(&amp;rwlock);
          }
          else if (i &lt; offset + insert_op + delete_op) {  //delete
              pthread_rwlock_wrlock(&amp;rwlock);
              Delete(test[i]);
              pthread_rwlock_unlock(&amp;rwlock);
          }
          else {
              pthread_rwlock_rdlock(&amp;rwlock);
              Member(test[i]);
              pthread_rwlock_unlock(&amp;rwlock);
          }
      }
      return NULL;
  }
  
  int Insert(int value)
  {
      struct Node*curr_p = head;
      struct Node*pred_p = NULL;
      struct Node*temp_p;
  
      while (curr_p != NULL &amp;&amp; curr_p-&gt;data &lt; value)
      {
          pred_p = curr_p;
          curr_p = curr_p-&gt;next;
      }
  
      if (curr_p == NULL || curr_p-&gt;data &gt; value)
      {
          temp_p = malloc(sizeof(struct Node));
          temp_p-&gt;data = value;
          temp_p-&gt;next = curr_p;
  
          if (pred_p == NULL) /** New first node */
          {
              head = temp_p;
          }
          else
          {
              pred_p-&gt;next = temp_p;
          }
          return 1;
      }
      else /* value already in list*/
      {
          return 0;
      }
  }
  
  int Member(int value)
  {
      struct Node*curr_p = head;
  
      while (curr_p != NULL &amp;&amp; curr_p-&gt;data &lt; value)
      {
          curr_p = curr_p-&gt;next;
      }
      if (curr_p == NULL || curr_p-&gt;data &gt; value)
      {
          return 0;
      }
      else
      {
          return 1;
      }
  }
  
  int Delete(int value)
  {
      struct Node*curr_p = head;
      struct Node*pred_p = NULL;
  
      while (curr_p != NULL &amp;&amp; curr_p-&gt;data &lt; value)
      {
          pred_p = curr_p;
          curr_p = curr_p-&gt;next;
      }
      if (curr_p != NULL &amp;&amp; curr_p-&gt;data == value)
      {
          if (pred_p == NULL) /** deleting first node in list */
          {
              head = curr_p-&gt;next;
              free(curr_p);
          }
          else
          {
              pred_p-&gt;next = curr_p-&gt;next;
              free(curr_p);
          }
          return 1;
      }
      else /* Value isn't in list */
      {
          return 0;
      }
  }
  </code></pre>
  
  <p>I got following errors which exhibits, pthreads are not included:
  1.  IntelliSense: a value of type "void *" cannot be assigned to an entity of type "pthread_t *"
  2.  IntelliSense: a value of type "void *" cannot be assigned to an entity of type "Node *"
  3. cannot convert from 'void *' to 'pthread_t *'
  4. cannot convert from 'void *' to 'Node *'</p>
  
  <p>What's wrong with my setup?</p>