【发布时间】:2020-10-16 16:33:29
【问题描述】:
我尝试使用 elf 库在 Ubuntu 上编写一些代码。
但是,它有编译错误,我不知道出了什么问题。
请帮帮我,谢谢。
sudo apt-get install libelf-dev
$ gcc -O3 -Wall -lelf test.c
/tmp/ccRqW5Qo.o: In function `main':
test.c:(.text.startup+0xa): undefined reference to `elf_version'
collect2: error: ld returned 1 exit status
这是test.c的代码
#include <stdlib.h>
#include <stdio.h>
#include <libelf.h>
int main(void)
{
elf_version(EV_CURRENT);
return 0;
}
【问题讨论】: