If you try to build a simplest application on Linux with the Net-SNMP library (open a session and close the session - everything) you get this error

/usr/include/net-snmp/library/snmp_api.h:706:8: error: unknown type name 'netsnmp_transport' 

I suppose that I didn’t specify any compilation flag, or I didn’t connect it to anybody.

In essence, a five-line program:

 #include <stdio.h> #include <stdlib.h> #include <net-snmp/net-snmp-config.h> #include <net-snmp/session_api.h> int main(int argc, char **argv) { struct snmp_session s; void * session; // Выполняем инициализацию переменных snmp_sess_init(&s); session = snmp_sess_open(&s); // Закрываем сессию rc = snmp_sess_close(&s); if (rc == 0) { printf("Неудачное завершение сессии\n"); } else { printf("Программа завершилась нормально\n"); } return 0; } 

Can someone explain - what is the reason for the situation?

  • one
    judging by github.com/haad/net-snmp : #include <net-snmp/library/snmp_transport.h> - aleksandr barakin
  • @alexander barakin Thank you - it helped! - Sergey
  • @alexander_barakin But in what dock is it written ?! I think this is not the last squiggle. - Sergey
  • I have no idea. I just looked for references in the source. - aleksandr barakin

1 answer 1

type description of netsnmp_transport in the snmp_transport.h file:

 typedef struct netsnmp_transport_s { ... } netsnmp_transport; 

 $ apt-file search snmp_transport.h libsnmp-dev: /usr/include/net-snmp/library/snmp_transport.h 

connection:

 #include <net-snmp/library/snmp_transport.h>