在 Linux 上编译使用 POSIX aio 库(例如 aio_read()、aio_write() 等)的示例程序时,我遇到了链接器的困难。
我正在运行带有 2.6 内核的 Ubuntu,并使用了 apt-get 实用程序来安装 libaio。但即使我正在链接 aio 库,编译器仍然会给我链接器错误。
root@ubuntu:/home# g++ -L /usr/lib/libaio.a aio.cc -oaio
/tmp/cc5OE58r.o: In function `main':
aio.cc:(.text+0x156): undefined reference to `aio_read'
aio.cc:(.text+0x17b): undefined reference to `aio_error'
aio.cc:(.text+0x191): undefined reference to `aio_return'
collect2: ld returned 1 exit status
如果不在库 libaio.a 中,所有这些 aio_x 函数实际定义在哪里?