Open GoogleCodeExporter opened 9 years ago
Eclipse Arduino PLugin seems to have a similar problem:
https://github.com/jantje/arduino-eclipse-plugin/issues/10
If I remove "extern HardwareSerial Serial;" fromt he code, NB tells me "extern
HardwareSerial Serial;" but compile works. So seems that NB is not able to
resolve the already declared "Serial" variable.
Question now is: how to tell NB that this variable is already declared? Looking
over to the eclipse world, is might be, that the NB Arduino Plugin has the same
indexing problem ...
Original comment by tuxedo0...@gmail.com
on 3 Nov 2014 at 3:10
A small workaround, which is nit great, but works:
Instead of "extern" the "Serial" variable, redefine the already defines Serial:
//extern HardwareSerial Serial;
#define mySerial Serial
With help of that, there is no error shown in NB code editor and compile works.
But one is not able to "lookup" what "mySerial" is (initially) etc.
Original comment by tuxedo0...@gmail.com
on 3 Nov 2014 at 3:24
The workaround is not really applicable. Converting an application from
ArduinoIDE to NB means: refacturing code ...
I did another test:
switching from "Leonardo" back to "Uno".
removed the "extern ..." line and click "clean&build"... Build works, while NB
editor shows my "unable to resolve identifier 'Serial'".
Conclusion:
The "extern ..." line is already a workaround for a broken index. Seems that
something cannot be parsed correctly in editor view.
would be great if someone could confirm/react on this. I'm already searching
the root of the bug, but did not find anything (I'm not yet familiar with
NB+C/C++ ...).
regards,
Alex
Original comment by tuxedo0...@gmail.com
on 4 Nov 2014 at 1:39
Found the root of the issue, but yet no idea how to fix it:
HardwareSerial.h will "extern" the serial-variables based on flags:
UBRRH, UBRR0H, USBCON, UBRR1H, UBRR2H and UBRR3H
Those flags are set by device specific header files. For leonardo/micro
(atmega32u4) this is iom32u4.h. And in this file, those flags are set.
This header file is included by io.h, which is included by Arduino.h ...
So all in all: device is set by make-file correctly (can be verified by setting
a wrong avr device name/type). So arduino-h should include io.h, which shluld
include avr type specific header file, i.e. iom32u4.h ...
The include-chain seems to be complete, but netbeans does not recognize it?!
Any ideas?
Original comment by tuxedo0...@gmail.com
on 5 Nov 2014 at 11:10
Original issue reported on code.google.com by
tuxedo0...@gmail.com
on 31 Oct 2014 at 3:20