2014-01-13 89 views
0

有人可以幫我解決這個錯誤嗎?哪裏不對?數組類型具有不完整的結構iocb元素類型

[[email protected] tests]$ cat iocbtst.c 
#include <libaio.h> 

struct iovec     fsb_iovecs[1]; 

main() { 

    struct iovec *iovec_ptrs[1]; 

    iovec_ptrs[0]=&fsb_iovecs[0]; 

} 
[[email protected] tests]$ gcc -c iocbtst.c 
iocbtst.c:3:30: error: array type has incomplete element type 
struct iovec     fsb_iovecs[1]; 
          ^
[[email protected] tests]$ 
[[email protected] tests]$ rpm -qa|grep libaio 
libaio-devel-0.3.109-7.fc19.x86_64 
libaio-debuginfo-0.3.109-7.fc19.x86_64 
libaio-0.3.109-7.fc19.x86_64 
[[email protected] tests]$ 

這是在Fedora 19,內核3.12.5-200.fc19.x86_64

[[email protected] tests]$ grep -A 15 struct\ iocb\ { /usr/include/libaio.h 
struct iocb { 
    PADDEDptr(void *data, __pad1); /* Return in the io completion event */ 
    PADDED(unsigned key, __pad2); /* For use in identifying io requests */ 

    short  aio_lio_opcode; 
    short  aio_reqprio; 
    int  aio_fildes; 

    union { 
     struct io_iocb_common  c; 
     struct io_iocb_vector  v; 
     struct io_iocb_poll  poll; 
     struct io_iocb_sockaddr saddr; 
    } u; 
}; 

[[email protected] tests]$ 

回答

2
iocbtst.c:3:30: error: array type has incomplete element type 
struct iovec     fsb_iovecs[1]; 

我覺得抱怨是因爲iovec。嘗試包括<sys/uio.h>

相關問題