2014-01-13 52 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>

相关问题