C PCAP library unknown types error

后端 未结 2 874
無奈伤痛
無奈伤痛 2021-02-05 21:14

I installed the pcap library on my linux system but when including it I get the errors

 /usr/include/pcap/bpf.h:88:1: error: unknown type name ‘u_int’
 /usr/incl         


        
相关标签:
2条回答
  • 2021-02-05 21:41

    Make sure you do NOT define any of:

    • __STRICT_ANSI__
    • _ISOC99_SOURCE
    • _POSIX_SOURCE
    • _POSIX_C_SOURCE
    • _XOPEN_SOURCE
    • _SVID_SOURCE

    when building your program; they may prevent the BSD data types, such as the ones the compile is complaining about, from being defined.

    0 讨论(0)
  • 2021-02-05 21:55

    Try adding

         -D_BSD_SOURCE
    

    az a CFLAG to your Makefile.

    0 讨论(0)
提交回复
热议问题