linux - C++: undefined reference to `sd_notify' -


i'm new c++. problem have process creates lot of processes, want identify(get pid) of 1 of children. looping through children take lot of resources(don't ask why). i'm trying pid of process (somehow) identifying if uses sd_notify , pid(i don't if possible). i'm using ubuntu 14.04 , created little test program:

#include <systemd/sd-daemon.h> #include <stdio.h>  int main() {   int a;   = sd_notify(0, "ready=1");   printf("%d -> \n", a);   fflush(stdout); } 

but gives me error saying undefined reference 'sd_notify'.

p.s found sd_notify systemd systems. equivalent of in upstart systems? or how can make sure process i'm searching doen't use function? or possible log messages send processes using sd_notify?

try installing libsystemd-daemon-devel , compile using

g++ -o sig sig.cpp -lsystemd-daemon


Comments