C program using net-snmp does not compile.



  • I have installed net-snmp 5.8 on a Ubuntu 16.0.4 machine and then I have checked the correct installation:
    snmpget --version
    NET-SNMP version: 5.8

    Next, I am trying to write and compile my first SNMP C program example.

    I have copied the one that is included as example on the tutorial from Ben Rockwood ("The Net-SNMP Programming Guide)
    and I have tried to compile it with the command:
    gcc ‘net-snmp-config --cflags‘ ‘net-snmp-config --libs‘ \

    ‘net-snmp-config --external-libs‘ snmp_test.c -o snmp_test
    As indicated in this tutorial.

    When do, I get the errors:
    gcc: error: unrecognized command line option ‘--cflags‘’
    gcc: error: unrecognized command line option ‘--libs‘’
    gcc: error: unrecognized command line option ‘--external-libs‘’

    Then I have changed the gcc command to:
    gcc net-snmp-config --cflags net-snmp-config --libs \

    net-snmp-config --external-libs snmp_test.c -o snmp_test
    And get the error:
    bash: net-snmp-config --external-libs: ambiguous redirect

    What is wrong on the gcc call? Any comments or suggestions are welcome.



  • Maybe try a Ubuntu / Linux forum, pfSense is based on FreeBSD 😉

    https://askubuntu.com/questions/336590/error-while-compiling



  • @NogBadTheBad

    Sorry for my mistake.

    I am going to try on the ubuntu forum.

    Thanks.



  • @jstech The answer is in the link i posted :)


Log in to reply