Sachin Hosmani
Sachin Hosmani

Reputation: 1752

How to build and use Sigar for C/C++?

Since there are no instructions on their wiki or Github, this is what I tried:

  1. Cloned the git repository
  2. make
  3. To run examples/cpuinfo.c:

cd examples/

gcc -Wall -I../include -L../build-src -lsigar cpuinfo.c

It gives me:

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'

What do I have to link it with to resolve these errors?

Upvotes: 0

Views: 752

Answers (1)

user3159253
user3159253

Reputation: 17455

Move -lsigar to the end of the list, after cpuinfo.c

Upvotes: 1

Related Questions