2017-03-07 9 views
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 "を参照してください。それはなぜまだ失敗するのですか?

+0

私の回答があなたの問題を解決しましたか? –

答えて

2

sudo apt-get install libaio-dev問題を確実に修正するはずです。これは、LinuxカーネルのAIOアクセスライブラリ用の開発ファイルです。

関連する問題