Discussion:
Error in Compiling
(too old to reply)
Joe Barrett
2005-05-12 00:41:00 UTC
Permalink
In my message queue struct, as I had in my semaphore struct, I have:

struct Thread_Queue foo;

I had one of these for project 3, to keep track of what threads could
access the semaphore, and now I've got one for sending and one for
receiving (so I can handle one or the other blocking, etc.). However,
I'm getting an error when attempting to compile:

In file included from ../include/geekos/kthread.h:15,
from ../src/geekos/syscall.c:13:
../include/geekos/message.h:40: error: field `sending' has incomplete type
../include/geekos/message.h:41: error: field `receiving' has incomplete type
gmake: *** [geekos/syscall.o] Error 1

I made sure to include kthread.h and list.h, and yet the error
continues. The code is - as best I can tell - identical to the
semaphores project, but I can't make it stop erroring.

Thanks,
Joe
Iulian Neamtiu
2005-05-12 01:55:52 UTC
Permalink
This means the compiler doesn't see a definition for the type of
.sending/.receiving. What I suggest you do, include kthread.h before
including message.h, or in syscall.c just try to mirror the #includes
you had for the semaphore project (name/order).


Iulian
Post by Joe Barrett
struct Thread_Queue foo;
I had one of these for project 3, to keep track of what threads could
access the semaphore, and now I've got one for sending and one for
receiving (so I can handle one or the other blocking, etc.). However,
In file included from ../include/geekos/kthread.h:15,
../include/geekos/message.h:40: error: field `sending' has incomplete type
../include/geekos/message.h:41: error: field `receiving' has incomplete type
gmake: *** [geekos/syscall.o] Error 1
I made sure to include kthread.h and list.h, and yet the error
continues. The code is - as best I can tell - identical to the
semaphores project, but I can't make it stop erroring.
Thanks,
Joe
Joe Barrett
2005-05-12 02:11:52 UTC
Permalink
Post by Iulian Neamtiu
This means the compiler doesn't see a definition for the type of
.sending/.receiving. What I suggest you do, include kthread.h before
including message.h, or in syscall.c just try to mirror the #includes
you had for the semaphore project (name/order).
Iulian
The headers are included in the proper order, so I'm not too sure what
the problem is. If I make the type a pointer to a struct instead of
just a struct, it functions properly - though I didn't have to do that
for Project 3.

syscall.c has the same includes as project3 [which I built off] with the
addition of my header file for project6, appended at the bottom.

Anything that would cause that problem?

Thanks,
Joe
c***@CSIC.UMD.EDU
2005-05-12 20:24:25 UTC
Permalink
read Neil Castine's post on 05/05/2005 and the related posts.

since mq.h is included for every user program, you can't include kernel header
files (kthread.h) in your mqueue.h ... so just do all struct definitions in the
mqueue.c and you will avoid the userland-kernelland errors.

Continue reading on narkive:
Loading...