Description
IDE 1.0.4.
Test case:
main sketch:
/*
Test sketch
*/
Open new tab in IDE, create tab named: partb.ino
Put this in partb.ino:
#include <SPI.h> // SPI library for sending data to the shift registers
byte foo [] = {
1,
2 // <---- this line has the error (line 5)
3,
4 };
byte bar [] =
{
5,
6,
7,
8, // <---- this line given as error line (line 14)
9,
10,
11};
Compile (eg. with Uno as target).
Error is reported at line 14:
partb:14: error: expected `}' before numeric constant
partb:14: error: expected ',' or ';' before numeric constant
partb:15: error: expected declaration before '}' token
However error is actually at line 5.
Generated combined (concatenated) file in the temporary directory is:
#line 1 "sketch_jun22b.ino"
/*
Test sketch
*/
#line 1 "partb.ino"
#include <SPI.h> // SPI library for sending data to the shift registers
#include "Arduino.h"
#line 11
byte foo [] = {
1,
2 // <---- this line has the error (line 5)
3,
4 };
byte bar [] =
{
5,
6,
7,
8, // <---- this line given as error line (line 14)
9,
10,
11};
Note that the #line 11 directive is wrong. It is out by the number of lines in the main sketch. It is not line 11, it is line 3.
The #line directive appears to be out by 9 lines. This appears to be the number of lines in the main sketch, plus one for the #include "Arduino.h" line. (Plus one extra one, depending on which line the error is really on).
This is a simplified version of a much larger sketch that exhibited this problem. In that sketch the line number was way out, making spotting the error very hard.