Hi,

>I need to prototype a stand-alone C application that uses the Net-SNMP
>library functions to send a SNMPv1 trap (e.g. coldStart). I have had
>very little success and I am looking for help. I am writing this
>application on a RedHat Linux platform.


I suggest looking at the code of the snmptrap-utility, it helped me a lot!

>-----> BEGIN CODE: makefile <-----
>CC=3Dgcc
>TARGETS=3Dsend_trap agent
>TOBJ=3Dsend_trap.o
>AOBJ=3Dagent.o
>
>CFLAGS=3D-I. 'net-snmp-config --cflags`
>BUILDLIBS=3D`net-snmp-config --libs`
>BUILDAGENTLIBS=3D`net-snmp-config --agent-libs`
>
># shared library flags (assumes gcc)
>DLFLAGS=3D-fPIC -shared
>
>send_trap: $(TOBJ)
> $(CC) -o send_trap $(TOBJ) $(BUILDLIBS)
>
>clean:
> rm $(TOBJ) $(AOBJ) $(TARGETS)
>-----> END CODE <-----


The Makefile is OK but there seem to be some unnecessary things in it:

"agent" in the TARGETS-list
complete "AOBJ" line
complete "BUILDAGENTLIBS" line
complete "shared library" section
"$(AOBJ)" statement in "rm" command of clean-target


>gcc -I. `net-snmp-config --cflags` -c -o send_trap.o send_trap.c
>gcc -o send_trap send_trap.o `net-snmp-config --libs`
>/usr/bin/ld: skipping incompatible libnetsnmp.so when searching for
>-lnetsnmp
>/usr/bin/ld: skipping incompatible libnetsnmp.a when searching for
>-lnetsnmp


It looks like you have some sort of incompatible version of the netsnmp-lib=
rary in your system (different architecture?),
does send_trap link and work? If so you also have a usable version on your =
HD and things should be fine but I=B4d search for that "incompatible" versi=
on...

regards
Wolfgang

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?p...orge&CID=3DDE=
VDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders