2017-03-07 5 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 액세스 라이브러리 용 - 개발 파일입니다.