由于他们的wiki或Github上没有说明,这就是我尝试过的:
make
examples/cpuinfo.c
: cd examples/
gcc -Wall -I../include -L../build-src -lsigar cpuinfo.c
它给了我:
cpuinfo.c:(.text+0x20): undefined reference to `sigar_open'
cpuinfo.c:(.text+0x33): undefined reference to `sigar_cpu_list_get'
cpuinfo.c:(.text+0x4d): undefined reference to `sigar_strerror'
cpuinfo.c:(.text+0xff): undefined reference to `sigar_cpu_list_destroy'
cpuinfo.c:(.text+0x10b): undefined reference to `sigar_close'
我需要将其链接以解决这些错误?
答案 0 :(得分:1)
在cpuinfo.c
之后将-lsigar
移动到列表的末尾