다음과 같이 매우 간단한 .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 액세스 라이브러리-개발 파일 용입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다