linux C++:libaio.h 不包含 io_context_t 的定义?

linux C++: libaio.h doesn't contain definition for io_context_t?

我有一个超级简单的 .cpp 文件,如下所示:

    $cat test001.cpp
    #include<libaio.h>
    int main(){
        io_context_t ctx={0};
        struct iocb io,*p=&io;
        return 0;
    }

但是用gcc 4.1.2编译后,提示错误:

    $g++ test001.cpp -laio
    test001.cpp:1:19: error: libaio.h: No such file or directory
    test001.cpp: In function ‘int main()’:
    test001.cpp:3: error: ‘io_context_t’ was not declared in this scope
    test001.cpp:3: error: expected `;' before ‘ctx’
    test001.cpp:4: error: aggregate ‘iocb io’ has incomplete type and cannot be defined

嗯,我已经在使用 "libaio.h"。为什么还是失败了?

sudo apt-get install libaio-dev 它肯定能解决问题。它用于 Linux 内核 AIO 访问库 - 开发文件。