[AGENT++] linking error, msec.cpp:277: undefined reference to `Snmp_pp::msec::m_localtime_mutex'

Cristian Saavedra cristianpsg at gmail.com
Wed Jun 11 13:29:59 CEST 2014


Hi Michael,

It seems from your code errors that you are missing the pthread library.

Give it a try adding the pthread at linking.
On Jun 11, 2014 4:54 AM, "Gens" <Michael.Gens at tu-berlin.de> wrote:

> Hello,
>
> I wrote a short program to get some (switch) information only. But I get
> the linking errors
>
>
> ...
> Building target: snmp++get
>
> Invoking: GCC C++ Linker
>
> g++ -L/usr/lib64/ -o "snmp++get"  ./snmp++-3.3.4/src/address.o
> ./snmp++-3.3.4/src/asn1.o ./snmp++-3.3.4/src/counter.o
> ./snmp++-3.3.4/src/ctr64.o ./snmp++-3.3.4/src/eventlist.o
> ./snmp++-3.3.4/src/eventlistholder.o ./snmp++-3.3.4/src/gauge.o
> ./snmp++-3.3.4/src/integer.o ./snmp++-3.3.4/src/log.o
> ./snmp++-3.3.4/src/mp_v3.o ./snmp++-3.3.4/src/msec.o
> ./snmp++-3.3.4/src/msgqueue.o ./snmp++-3.3.4/src/notifyqueue.o
> ./snmp++-3.3.4/src/octet.o ./snmp++-3.3.4/src/oid.o
> ./snmp++-3.3.4/src/pdu.o ./snmp++-3.3.4/src/reentrant.o
> ./snmp++-3.3.4/src/snmpmsg.o ./snmp++-3.3.4/src/target.o
> ./snmp++-3.3.4/src/timetick.o ./snmp++-3.3.4/src/usm_v3.o
> ./snmp++-3.3.4/src/uxsnmp.o ./snmp++-3.3.4/src/v3.o ./snmp++-3.3.4/src/vb.o
>  ./get_group.o ./get_singleMIB.o ./help.o ./mainSnmp++get.o ./usage.o
>
> ./snmp++-3.3.4/src/msec.o: In function `Snmp_pp::msec::get_printable()
> const':
> /home/gens/programming/eclipse/c/snmp++get/Debug/../snmp++-3.3.4/src/msec.cpp:277:
> undefined reference to `Snmp_pp::msec::m_localtime_mutex'
>
> ./snmp++-3.3.4/src/uxsnmp.o: In function `Snmp_pp::Snmp::start_poll_
> thread(int)':
> /home/gens/programming/eclipse/c/snmp++get/Debug/../
> snmp++-3.3.4/src/uxsnmp.cpp:2262: undefined reference to `pthread_create'
>
> ./snmp++-3.3.4/src/uxsnmp.o: In function `Snmp_pp::Snmp::stop_poll_
> thread()':
> /home/gens/programming/eclipse/c/snmp++get/Debug/../
> snmp++-3.3.4/src/uxsnmp.cpp:2296: undefined reference to `pthread_join'
>
>
>
> ... and I do not understand why there are no compiler errors and I have no
> clue what to do and how to avoid the linker errors.
>
> Can anybody help?
>
> If you need more detailed information please ask.
>
>
> Thank you very much in advance.
>
>
> --
>
> Best Rgds.
>
>
>                    Michael
>
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> https://s16675406.onlinehome-server.info/mailman/listinfo/agentpp
>


More information about the AGENTPP mailing list