简体   繁体   English

数组类型具有struct iocb的不完整元素类型

[英]array type has incomplete element type for struct iocb

Can somebody help me with this error ? 有人可以帮我解决这个错误吗? What is wrong? 怎么了?

[niko@localhost tests]$ cat iocbtst.c 
#include <libaio.h>

struct iovec                 fsb_iovecs[1];

main() {

    struct iovec *iovec_ptrs[1];

    iovec_ptrs[0]=&fsb_iovecs[0];

}
[niko@localhost tests]$ gcc -c iocbtst.c 
iocbtst.c:3:30: error: array type has incomplete element type
 struct iovec                 fsb_iovecs[1];
                              ^
[niko@localhost tests]$
[niko@localhost 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
[niko@localhost tests]$ 

This is with Fedora 19, kernel 3.12.5-200.fc19.x86_64 这是Fedora 19,内核3.12.5-200.fc19.x86_64

[niko@localhost 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;
};

[niko@localhost tests]$ 
 iocbtst.c:3:30: error: array type has incomplete element type struct iovec fsb_iovecs[1]; 

I think it complains because of iovec . 我认为它因为iovec而抱怨。 Try including <sys/uio.h> . 尝试包括<sys/uio.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM