[AGENT++] Static linking?

Jochen Katz katz at agentpp.com
Wed Sep 24 20:32:35 CEST 2014


Hello,

> Is there a chance to link files of SNMP++ - library statically into my
> projects?

yes.

> I already tried  "-static"  as linker option but I am running into errors:

> g++ -static -pthread -lsnmp++ -o "<file>"  ./<file1>.o ./<file2>.o
> ./<file3>.o ./<file4>.o ./<file5>.o ./<file5>.o ./<file6>.o ./<file7>.o
> /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
> cannot find -lm
> /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
> cannot find -lpthread
> /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
> cannot find -lc

With this option, all libraries have to be available as static library.
Your system is missing static versions of libc, libm and libpthread.

Instead of "-static" and "-lsnmp++", just specify the static library:
"path/libsnmp++.a"

Regards,
  Jochen


More information about the AGENTPP mailing list