title: Why am I getting this error: dereferencing pointer to incomplete type
body: <p>I am working on a project for class with probably the WORST instruction ever where we have to implement a simple scheduler.. although C programming is not a prereq for the course, that is the language of the scheduler and I'm not necessarily a C programmer..</p>
  
  <p>Anyhow, I am trying to debug this by printing out the task so I can trace it through the program, but I keep getting the following compile-time error:</p>
  
  <blockquote>
    <p>schedule.c:61:48: error: dereferencing pointer to incomplete type</p>
  </blockquote>
  
  <p>This is the <code>task_struct</code> definition:</p>
  
  <pre><code>struct task_struct
  {
      struct thread_info *thread_info;        
      int prio, static_prio, normal_prio;     
      unsigned long sleep_avg;            
      unsigned long long last_ran;            
      unsigned long long timestamp;           
      unsigned long long sched_time;          
      unsigned int time_slice, first_time_slice;  
      struct list_head run_list;          
      struct sched_array *array;          
      enum sleep_type sleep_type;         
      int need_reschedule;                
  };
  </code></pre>
  
  <p>The function im trying to debug inside:</p>
  
  <pre><code>void initschedule(struct runqueue *newrq, struct task_struct *seedTask)
  {
  printf("Inside initschedule()\n");
  
  printf("%s - TEST \n", (seedTask)-&gt;thread_info-&gt;processName); //causes compiler error
  
  /* initialize runqueue and current task */
  rq = newrq;
  current = NULL;
  
  /* allocate memory for runqueue schedule arrays */
  rq-&gt;active = (struct sched_array*)malloc(sizeof(struct sched_array));
  rq-&gt;expired = (struct sched_array*)malloc(sizeof(struct sched_array));
  
  /* initialize schedule arrays */
  INIT_LIST_HEAD(&amp;rq-&gt;active-&gt;list);
  INIT_LIST_HEAD(&amp;rq-&gt;active-&gt;list);
  
  /* activate task in scheduler */
  activate_task(seedTask);
  </code></pre>
  
  <p>}</p>
  
  <p>The strangest thing is that when I use the same <code>printf(...)</code> in the method that calls the above function, it works, but just not in my function where the <code>seedTask</code> is passed into.</p>
  
  <p>So basically, I am wondering why am I getting this error?</p>