Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    C program using net-snmp does not compile.

    Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
    4 Posts 2 Posters 726 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jstech
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • NogBadTheBadN
        NogBadTheBad
        last edited by NogBadTheBad

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

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

        Andy

        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

        J 1 Reply Last reply Reply Quote 0
        • J
          jstech @NogBadTheBad
          last edited by

          @NogBadTheBad

          Sorry for my mistake.

          I am going to try on the ubuntu forum.

          Thanks.

          NogBadTheBadN 1 Reply Last reply Reply Quote 0
          • NogBadTheBadN
            NogBadTheBad @jstech
            last edited by

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

            Andy

            1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.