NS2中 #include <wireless-phy.h> 引发的问题

NS2中,如果想要引用WirelessPhy类,我们需要#include <wireless-phy.h>,编译的时候,会报出很多错误

错误原因如下:


 "In file wireless-phy.h, line enum ChannelStatus { SLEEP, IDLE, RECV, SEND };跟
In file cmu-trace.h, there are two lines:    #define RECV .. #define SEND.."

这两次定义是冲突的,从而导致未定义等等错误(4个错误以上)

 

修改方法:
将其中之一换一个名字,比如:

       修改wireless-phy.h/c中的{ SLEEP, IDLE, RECV, SEND }为{ SLEEP, IDLE, RRECV, SSEND };  以及对应的 c文件中的引用(好像只有一次使用)即可

貌似改这个枚举类型需要改动的地方比较少,只有这两个文件中引用。而cmu-trace.h中的那两个宏的使用我未查询过,有待考证比较

 

 

附:

可能报的错误: 碰到类似错误的童鞋可以参考一下

./mac/wireless-phy.h: At global scope:
./mac/wireless-phy.h:130: error: expected identifier before 'r'
./mac/wireless-phy.h:130: error: expected ‘}’ before 'r'
./mac/wireless-phy.h:130: error: expected unqualified-id before 'r'
./mac/wireless-phy.h: In member function ‘bool& WirelessPhy::Is_node_on()’:
./mac/wireless-phy.h:97: error: ‘node_on_’ was not declared in this scope
./mac/wireless-phy.h: In member function ‘bool WirelessPhy::Is_sleeping()’:
./mac/wireless-phy.h:98: error: ‘status_’ was not declared in this scope
./mac/wireless-phy.h: At global scope:
./mac/wireless-phy.h:132: error: no matching function for call to ‘Sleep_Timer::Sleep_Timer()’
./mac/wireless-phy.h:58: note: candidates are: Sleep_Timer::Sleep_Timer(WirelessPhy*)
./mac/wireless-phy.h:56: note:                 Sleep_Timer::Sleep_Timer(const Sleep_Timer&)
./mac/wireless-phy.h: In function ‘int initialized()’:
./mac/wireless-phy.h:137: error: ‘node_’ was not declared in this scope
./mac/wireless-phy.h:137: error: ‘uptarget_’ was not declared in this scope
./mac/wireless-phy.h:137: error: ‘downtarget_’ was not declared in this scope
./mac/wireless-phy.h:137: error: ‘propagation_’ was not declared in this scope
./mac/wireless-phy.h: In function ‘EnergyModel* em()’:
./mac/wireless-phy.h:143: error: ‘node’ was not declared in this scope
./mac/wireless-phy.h: At global scope:
./mac/wireless-phy.h:147: error: expected declaration before ‘}’ token
make: *** [aodv/aodv.o] 错误 1

``` /include/ "system-conf.dtsi" #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> #include <dt-bindings/media/xilinx-vip.h> #include <dt-bindings/phy/phy.h> / { model = "Alientek Navigator Zynq Development Board"; compatible = "xlnx,zynq-zc702", "xlnx,zynq-7000"; leds { compatible = "gpio-leds"; gpio-led1 { label = "led2"; gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; default-state = "on"; }; gpio-led2 { label = "led1"; gpios = <&gpio0 54 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; }; gpio-led3 { label = "pl_led0"; gpios = <&axi_gpio_0 0 0 GPIO_ACTIVE_HIGH>; default-state = "on"; }; gpio-led4 { label = "pl_led1"; gpios = <&axi_gpio_0 1 0 GPIO_ACTIVE_HIGH>; linux,default-trigger = "timer"; }; gpio-led5 { label = "ps_led0"; gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; default-state = "on"; }; gpio-led6 { label = "ps_led1"; gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; linux,default-trigger = "timer"; }; }; keys { compatible = "gpio-keys"; autorepeat; gpio-key1 { label = "pl_key0"; gpios = <&gpio0 55 GPIO_ACTIVE_LOW>; linux,code = <KEY_LEFT>; gpio-key,wakeup; autorepeat; }; gpio-key2 { label = "pl_key1"; gpios = <&gpio0 56 GPIO_ACTIVE_LOW>; linux,code = <KEY_RIGHT>; gpio-key,wakeup; autorepeat; }; gpio-key3 { label = "ps_key1"; gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; linux,code = <KEY_UP>; gpio-key,wakeup; autorepeat; }; gpio-key4 { label = "ps_key2"; gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; linux,code = <KEY_DOWN>; gpio-key,wakeup; autorepeat; }; touch-key { label = "touch_key"; gpios = <&gpio0 57 GPIO_ACTIVE_HIGH>; linux,code = <KEY_ENTER>; gpio-key,wakeup; autorepeat; }; }; beep { compatible = "gpio-beeper"; gpios = <&gpio0 58 GPIO_ACTIVE_HIGH>; }; usb_phy0: phy0@e0002000 { compatible = "ulpi-phy"; #phy-cells = <0>; reg = <0xe0002000 0x1000>; view-port = <0x0170>; drv-vbus; }; }; &uart0 { u-boot,dm-pre-reloc; status = "okay"; }; &sdhci0 { u-boot,dm-pre-reloc; status = "okay"; }; &usb0 { dr_mode = "otg"; usb-phy = <&usb_phy0>; }; &qspi { u-boot,dm-pre-reloc; flash@0 { /* 16 MB */ compatible = "w25q256", "jedec,spi-nor"; reg = <0x0>; spi-max-frequency = <50000000>; #address-cells = <1>; #size-cells = <1>; partition@0x00000000 { label = "boot"; reg = <0x00000000 0x00100000>; }; partition@0x00100000 { label = "bootenv"; reg = <0x00100000 0x00020000>; }; partition@0x00120000 { label = "bitstream"; reg = <0x00120000 0x00400000>; }; partition@0x00520000 { label = "device-tree"; reg = <0x00520000 0x00020000>; }; partition@0x00540000 { label = "kernel"; reg = <0x00540000 0x00500000>; }; partition@0x00A40000 { label = "space"; reg = <0x00A40000 0x00000000>; }; }; }; &gem0 { local-mac-address = [00 0a 35 00 8b 87]; phy-handle = <&ethernet_phy>; ethernet_phy: ethernet-phy@7 { /* yt8521 */ reg = <0x7>; device_type = "ethernet-phy"; }; }; &gem1 { local-mac-address = [00 0a 35 00 11 55]; phy-reset-gpio = <&gpio0 63 GPIO_ACTIVE_LOW>; phy-reset-active-low; phy-handle = <&pl_phy>; pl_phy: pl_phy@4 { reg = <0x4>; device_type = "ethernet-phy"; }; }; &watchdog0 { status = "okay"; reset-on-timeout; // Enable watchdog reset function }; &adc { status = "okay"; xlnx,channels { #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; }; }; }; &i2c0 { clock-frequency = <100000>; eeprom@50 { compatible = "atmel,24c64"; reg = <0x50>; pagesize = <32>; }; rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; }; };```如何查看linux内核支持哪些驱动
最新发布
03-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值