简体   繁体   English

libpcap中的属性错误

[英]Error with attribute in libpcap

I'm using the code from here to for 802.11 sniffing in monitor mode. 我正在使用此处的代码在监控模式下进行802.11嗅探。

#define ETH_HEADER_SIZE 14
#define AVS_HEADER_SIZE 64                 /* AVS capture header size */
#define DATA_80211_FRAME_SIZE 24           /* header for 802.11 data packet */
#define LLC_HEADER_SIZE 8                  /* LLC frame for encapsulation */
/* SNAP LLC header format */
struct snap_header           
{
  u_int8_t dsap; 
  u_int8_t ssap;
  u_int8_t ctl;
  u_int16_t org; 
  u_int8_t org2;
  u_int16_t ether_type;          /* ethernet type */              
} __attribute__ ((__packed_  _));

I'm not quite an expert about c++, and I'm getting this error: 我不是有关c ++的专家,并且遇到了以下错误:

error: expected ‘)’ before ‘_’ warning: ‘__packed_’ attribute  
directive ignored [-Wattributes]  } __attribute__ ((__packed_  _));

The page where you got that code added some bogus spaces to the __attribute__ ((__packed__)) declaration. 获得该代码的页面在__attribute__ ((__packed__))声明中添加了一些虚假空格。 It should be exactly as I wrote it there, with no spaces between any of the the underscores. 它应该与我在此处所写的完全相同 ,下划线之间没有空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM