有人可以帮我解决这个错误吗?有什么问题?
[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]$
这是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]$
答案 0 :(得分:2)
iocbtst.c:3:30: error: array type has incomplete element type struct iovec fsb_iovecs[1];
我认为它因iovec
而抱怨。尝试加入<sys/uio.h>
。