Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lalitsudhakar opened this issue Apr 29, 2020 · 1 comment

Comments

@lalitsudhakar
Copy link

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
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants