0
我有一个超级简单的.cpp文件象下面这样:linux C++:libaio.h不包含io_context_t的定义?
$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”。为什么它仍然失败?
难道我的回答解决您的问题? –