andrewrapp / xbee-arduino

Arduino library for communicating with XBee radios in API mode
GNU General Public License v2.0
334 stars 162 forks source link

error: 'int printResponseCb' redeclared as different kind of symbol #87

Open lalitsudhakar opened 4 years ago

lalitsudhakar commented 4 years ago

Arduino: 1.8.7 (Windows 10), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

In file included from C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino:22:0:

Printers.h:115:21: error: 'int printResponseCb' redeclared as different kind of symbol

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                 ^

sketch\Printers.h:114:6: note: previous declaration 'void printResponseCb(ZBRxResponse&, uintptr_t)'

void printResponseCb(ZBRxResponse& rx, uintptr_t data);

  ^

Printers.h:115:21: error: 'ZBExplicitRxResponse' was not declared in this scope

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                 ^

Printers.h:115:43: error: 'rx' was not declared in this scope

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                                       ^

Printers.h:115:57: error: expected primary-expression before 'data'

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                                                     ^

Printers.h:145:27: error: variable or field 'printResponse' declared void

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                       ^

Printers.h:145:27: error: 'ZBExplicitRxResponse' was not declared in this scope

Printers.h:145:49: error: 'r' was not declared in this scope

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                                             ^

Printers.h:145:57: error: expected primary-expression before '&' token

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                                                     ^

Printers.h:145:59: error: 'print' was not declared in this scope

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                                                       ^

In file included from sketch\Printers.cpp:1:0:

Printers.h:115:21: error: 'int printResponseCb' redeclared as different kind of symbol

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                 ^

sketch\Printers.h:114:6: note: previous declaration 'void printResponseCb(ZBRxResponse&, uintptr_t)'

void printResponseCb(ZBRxResponse& rx, uintptr_t data);

  ^

Printers.h:115:21: error: 'ZBExplicitRxResponse' was not declared in this scope

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                 ^

Printers.h:115:43: error: 'rx' was not declared in this scope

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                                       ^

Printers.h:115:57: error: expected primary-expression before 'data'

int printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data);

                                                     ^

ZdpScan:35:1: error: 'XBeeWithCallbacks' does not name a type

XBeeWithCallbacks xbee;

^

ZdpScan:110:20: error: 'ZBExplicitRxResponse' was not declared in this scope

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                ^

ZdpScan:110:42: error: 'rx' was not declared in this scope

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                                      ^

ZdpScan:110:56: error: expected primary-expression before 'data'

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                                                    ^

ZdpScan:123:1: error: 'ZBExplicitTxRequest' does not name a type

ZBExplicitTxRequest buildZdoRequest(XBeeAddress64 addr, uint16_t cluster_id, uint8_t *payload, size_t len) {

^

ZdpScan:139:55: error: 'ZBExplicitRxResponse' has not been declared

bool handleZdoRequest(const __FlashStringHelper msg, ZBExplicitRxResponse& rx, XBeeAddress64 addr, uint16_t cluster_id, uint8_t payload, size_t len) {

                                                   ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'void toggle(XBeeAddress64&)':

ZdpScan:100:3: error: 'ZBExplicitTxRequest' was not declared in this scope

ZBExplicitTxRequest tx(addr, 0xfffe, 0, 0, payload, sizeof(payload), 0, 9, 9, 0x0006, 0x0104) ;

^

ZdpScan:101:3: error: 'tx' was not declared in this scope

tx.setFrameId(xbee.getNextFrameId());

^

ZdpScan:101:17: error: 'xbee' was not declared in this scope

tx.setFrameId(xbee.getNextFrameId());

             ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: At global scope:

ZdpScan:110:20: error: redefinition of 'bool matchZdoReply'

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino:110:6: note: 'bool matchZdoReply' previously defined here

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

  ^

ZdpScan:110:20: error: 'ZBExplicitRxResponse' was not declared in this scope

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                ^

ZdpScan:110:42: error: 'rx' was not declared in this scope

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                                      ^

Printers.h:145:27: error: variable or field 'printResponse' declared void

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                       ^

Printers.h:145:27: error: 'ZBExplicitRxResponse' was not declared in this scope

Printers.h:145:49: error: 'r' was not declared in this scope

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                                             ^

Printers.h:145:57: error: expected primary-expression before '&' token

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                                                     ^

Printers.h:145:59: error: 'print' was not declared in this scope

inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); }

                                                       ^

ZdpScan:110:56: error: expected primary-expression before 'data'

bool matchZdoReply(ZBExplicitRxResponse& rx, uintptr_t data) {

                                                    ^

ZdpScan:123:1: error: 'ZBExplicitTxRequest' does not name a type

ZBExplicitTxRequest buildZdoRequest(XBeeAddress64 addr, uint16_t cluster_id, uint8_t *payload, size_t len) {

^

ZdpScan:139:55: error: 'ZBExplicitRxResponse' has not been declared

bool handleZdoRequest(const __FlashStringHelper msg, ZBExplicitRxResponse& rx, XBeeAddress64 addr, uint16_t cluster_id, uint8_t payload, size_t len) {

                                                   ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'bool handleZdoRequest(const __FlashStringHelper, int&, XBeeAddress64, uint16_t, uint8_t, size_t)':

ZdpScan:140:3: error: 'ZBExplicitTxRequest' was not declared in this scope

ZBExplicitTxRequest tx = buildZdoRequest(addr, cluster_id, (uint8_t*)payload, len);

^

ZdpScan:141:3: error: 'xbee' was not declared in this scope

xbee.send(tx);

^

ZdpScan:141:13: error: 'tx' was not declared in this scope

xbee.send(tx);

         ^

ZdpScan:150:10: error: 'XBEE_WAIT_TIMEOUT' was not declared in this scope

 case XBEE_WAIT_TIMEOUT:

      ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'void get_active_endpoints(XBeeAddress64&, uint16_t)':

ZdpScan:183:3: error: 'ZBExplicitRxResponse' was not declared in this scope

ZBExplicitRxResponse rx;

^

ZdpScan:185:25: error: 'rx' was not declared in this scope

                     rx, addr, ZDO_ACTIVE_EP_REQ,

                     ^

ZdpScan:189:67: error: 'rx' was not declared in this scope

zdo_active_ep_rsp_header_t rsp = (zdo_active_ep_rsp_header_t)(rx.getFrameData() + rx.getDataOffset());

                                                               ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'void get_simple_descriptor(XBeeAddress64&, uint16_t, uint8_t)':

ZdpScan:215:3: error: 'ZBExplicitRxResponse' was not declared in this scope

ZBExplicitRxResponse rx;

^

ZdpScan:217:25: error: 'rx' was not declared in this scope

                     rx, addr, ZDO_SIMPLE_DESC_REQ,

                     ^

ZdpScan:221:73: error: 'rx' was not declared in this scope

zdo_simple_desc_resp_header_t rsp = (zdo_simple_desc_resp_header_t)(rx.getFrameData() + rx.getDataOffset());

                                                                     ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'bool getAtValue(uint8_t, uint8_t, size_t, uint16_t)':

ZdpScan:233:18: error: 'xbee' was not declared in this scope

req.setFrameId(xbee.getNextFrameId());

              ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'void scan_network()':

ZdpScan:331:7: error: 'ZBExplicitRxResponse' was not declared in this scope

   ZBExplicitRxResponse rx;

   ^

ZdpScan:333:29: error: 'rx' was not declared in this scope

                         rx, nodes[next].addr64, ZDO_MGMT_LQI_REQ,

                         ^

ZdpScan:337:55: error: 'rx' was not declared in this scope

   zdo_mgmt_lqi_rsp_t *rsp = (zdo_mgmt_lqi_rsp_t*)(rx.getFrameData() + rx.getDataOffset());

                                                   ^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'void setup()':

ZdpScan:424:3: error: 'xbee' was not declared in this scope

xbee.setSerial(XBeeSerial);

^

C:\Users\SudhakarLalit\Desktop\Research Journal\Building Wireless Sensor Networks Using Arduino\B03778_Code Bundle\Code\Chapter 4\ZdpScan\ZdpScan.ino: In function 'void loop()':

ZdpScan:460:3: error: 'xbee' was not declared in this scope

xbee.loop();

^

Printers.cpp:146:24: error: variable or field 'printResponseCb' declared void

void printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data) {

                    ^

Printers.cpp:146:24: error: 'ZBExplicitRxResponse' was not declared in this scope

Printers.cpp:146:46: error: 'rx' was not declared in this scope

void printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data) {

                                          ^

Printers.cpp:146:60: error: expected primary-expression before 'data'

void printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data) {

                                                        ^

exit status 1 'int printResponseCb' redeclared as different kind of symbol

matthijskooijman commented 4 years ago

Sounds like a problem in your sketch, maybe you put a function definition above the Printers.h include and forgot some kind of bracket somewhere? Looking at the error message, you're using ZdpScan.ino, but the line numbers are off, so I assume you've modified the sketch.

Also, just dumping error messages in an issue without further explanation or comments is not very polite IMHO. I'm not sure what the policy for this repository is, but often issues are primarily used for bugs in the library, not for getting help with debugging your own code. Asking for help might very well be ok, but you're not quite doing that either.

Anyway, to be able to help, you should probably also post the ZdpScan.ino file you are using. If you do, be sure to use triple backtick code blocks around your code, which makes it easier to read (you could edit your first post and add them around the error output too).