Linux C ++: libaio.h не содержит определения для 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». Почему до сих пор не получается?

0

Решение

sudo apt-get install libaio-dev Это должно определенно решить проблему. Это для библиотеки доступа к ядру Linux AIO — файлы для разработки.

2

Другие решения

Других решений пока нет …