Passing a struct to a thread
<p>Sorry for the second post, I find threads really complicated..
I am trying to pass a struct to a thread parameter, but I get the error:</p>

<pre><code> error: dereferencing pointer to incomplete type
 printf("%d\n", assembly-&gt;size);
</code></pre>

<p>I am not sure how to fix it, here is my main code(<strong>test.c</strong>).</p>

<pre><code>#include "test.h"


int main()
{

    assembly.size = 10;

    pthread_t thread_tid;
    pthread_create(&amp;thread_tid, NULL, foo, &amp;assembly);

    pthread_join(thread_tid, NULL);

return 0;
}
</code></pre>

<p>The function that the thread calls(<strong>test1.c</strong>):</p>

<pre><code>void * foo(void *param)
    {
        struct factory *assembly = param;
        printf("%d\n", assembly-&gt;size);
        return NULL;
    }
</code></pre>

<p>My header file which holds the struct definition(<strong>test.h</strong>):</p>

<pre><code>#ifndef TEST1_H
#define TEST1_H

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;pthread.h&gt;
#include "test1.c"

struct factory{
    int size;
    int products_per_box;
    int products_to_assemble;
};
struct factory assembly;

void * foo(void *param);

#endif
</code></pre>