Using pthread on Linux 2.4 - getting “incomplete type” compilation error?

Your linked list C file does not know about the struct readers_writers_t it's defined within your rw_lock. C file You should just move your struct readers_writers_t out of rw_lock. C and into your rw_lock.

H file Or perhaps you don't want your linked list to know about that struct. In that case, you should define the readers_writers rwLock as a pointer (readers_writers *rwLock) rather. Another alternative is to make your readers_writers typedef a pointer: typedef struct readers_writers_t *readers_writers This requires that functions in rw_lock.

C allocates space for the actual struct, as that's the only file that knows about the actual struct.

Your linked list C file does not know about the struct readers_writers_t, it's defined within your rw_lock. C file. You should just move your struct readers_writers_t out of rw_lock.

C and into your rw_lock. H file. Or perhaps you don't want your linked list to know about that struct.In that case, you should define the readers_writers rwLock as a pointer (readers_writers *rwLock) rather.

Another alternative is to make your readers_writers typedef a pointer: typedef struct readers_writers_t *readers_writers This requires that functions in rw_lock. C allocates space for the actual struct, as that's the only file that knows about the actual struct.

– Belgi May 15 at 22:06 If you use the struct itself, your linked list have to know how it's defined, otherwise it doesn't know how much storage to allocate for it. When you use a pointer, the compiler knows that all it has to do is allocate enough storage for a pointer, the compiler treats all pointers the same and doesn't need the struct itself. However if you want to dereference the pointer to work with any of the struct members, you do need to provide the struct definition.

– nos May 15 at 22:11 now I understand :-) thanks again. – Belgi May 15 at 22:12.

You need to move the structure defintion from the source file to the header file. Rw_lock. H should be: #ifndef SOME_UNIQUE_STRING_MY_RW_LOCK_H #define SOME_UNIQUE_STRING_MY_RW_LOCK_H #include struct readers_writers_t { int prio; int number_of_readers; pthread_cond_t no_readers; int number_of_writers; int number_of_waiting_writers; pthread_cond_t no_writers; pthread_mutex_t lock; }; typedef struct readers_writers_t readers_writers; #endif.

Did the trick,thank you. – Belgi May 15 at 22:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions