Arduino Compiler doesn't compile a particular sketch.

Hold on a minute. The includes are not wrong in the attachment to this forum thread. They look wrong in the github issue because they contain angle brackets which github markdown doesn't like.

If you re-test using the code enclosure above I believe you will see some of the most unusual output you've ever seen come out of the IDE. At least it was for me.

Best,

-br

i think the error is in the process where that .ino is secretly translated into a .cpp adding some code (main etc..), but your (and others) code break some regex somewhere... also the stack is unuseful to anderstand where this happen, so i'm downloading arduino's source, adding a lot of system.out.println("until here all good"); and find out where this happen, and work out a solution. But i'm at work and this weekend i'll have no time for this, so i hope to solve it soon.

Thanks, appreciate it :slight_smile:

If you comment out line 117, it compiles.

Something about this code:

  temp[ 25 ] = '\"';

You may be able to get going again by using a different means to assign the ascii quote character to temp[25]...

-br

Ok, so I kind of started over, and compiled the sketch after every action I took, to check where the problem started. I didn't solve the mystery, but I might have learnt something new.

Before I can explain what exactly happened, the reader needs to understand how I'm structuring this program.

I have two separate sketches I copy from: one that contains all the code necessary for control over the onboard real time clock (RTC), and one containing all the code necessary for control over the GPRS Shield I'm using.

My main objective is to log the times the Shield receives calls, and use the Shield to send data via text message at a predetermined time.
For this I simply need to combine my two aforementioned sketches, and add a few bits and bobs.

So everything I'm doing kind of happens in two halves: GPRS and RTC.
For my own sanity's sake, I keep the two devices' code separate.

Also, the function gprsListen() is the only GPRS function called directly from void loop(), and it's location actually made a difference, see below.

In the first sketch I attached, the order of all the parts were as follows:
includes for both devices
#defines for RTC
variable declarations for GPRS
variable declarations for RTC
GPRS functions (including the function gprsListen)
RTC functions
setup
loop (calls the gprsListen() function and updates the time)

The above structure made the compiler go all stupid. Now for the new structure (attached file):
#includes for both devices
#defines for RTC
variable declarations for GPRS
variable declarations for RTC
RTC functions
GPRS functions
setup
loop (calls the gprsListen() function and updates the time)
gprsListen()

Ok, so there are 2 major changes, and 1 very weird thing:
change 1: I had to swap the GPRS and RTC function bundles
change 2: I had to put the gprsListen() function somewhere below setup. Anywhere above setup, and the compiler goes all stupid again.
Very weird thing: In void setup() there is a Serial.println(""); indicated with a comment. If you comment it out, the sketch still compiles. If you delete the command, or only the quotes, the compiler goes all stupid with the same error.

Remember, effectively there is almost no difference between the sketches. They contain all the same functions and variables, I just pasted them in different places.

I don't know what any of this means, maybe you guys do.
Thanks so far

RemoteCallLoggerV0.ino (12.8 KB)

thanks billroy

So in the original sketch I changed " temp[ 25 ] = '"'; " to " temp[ 25 ] = char(34); "
It compiles now, and should work, but I'd still like to know what the problem was (is?). Technically there is nothing wrong with the way it was.

lesto:
i think the error is in the process where that .ino is secretly translated into a .cpp adding some code (main etc..), but your (and others) code break some regex somewhere... also the stack is unuseful to anderstand where this happen, so i'm downloading arduino's source, adding a lot of system.out.println("until here all good"); and find out where this happen, and work out a solution. But i'm at work and this weekend i'll have no time for this, so i hope to solve it soon.

i've spoken :P, we will see.
btw if you don't know what is a regex: Regular expression - Wikipedia

The " construct is not how to embed a double quote in a string. You use two double quotes, instead. On line 117, using '"' to describe what to store in the array element is wrong. It should be '"' (a single quote, a double quote, and a single quote). One line 114, the " needs to be changed to "" (Two double quotes). That will result in the line ending with three double quotes and a semicolon. Then, the code compiles.

There is no bug that needs to be dealt with in the IDE.

Ok, I understand now. The only thing that puzzles me is that I copied the code from another sketch, and that sketch worked just fine. I'll go read up on this stuff on my own time. Thanks everybody :slight_smile:

PaulS:
The " construct is not how to embed a double quote in a string. You use two double quotes, instead. On line 117, using '"' to describe what to store in the array element is wrong. It should be '"' (a single quote, a double quote, and a single quote). One line 114, the " needs to be changed to "" (Two double quotes). That will result in the line ending with three double quotes and a semicolon. Then, the code compiles.

There is no bug that needs to be dealt with in the IDE.

#include <stdio.h>

int main(void *args[]){
  char c= '\"';
  printf("%c", c);
  c='"';
  printf("%c", c);
  return 0;
}

work perfectly with gcc (GCC) 4.7.2 .
Also this is a STACK OVERFLOW from java, not an error or a warning from the compiler. So the IDE is broken, it is not a big problem because it can be worked-around, but there still a big fault in the IDE; also this bug is duplicate: Google Code Archive - Long-term storage for Google Code Project Hosting.

Problem part of code:

const char progdata[] PROGMEM = 
":100000000EC015C014C013C012C011C010C00FC064\
:100010000EC00DC00CC00BC00AC009C008C011241E\
:100020001FBECFE5D2E0DEBFCDBF02D02AC0E8CFF1\
:100030000F931F93DF93CF9300D0CDB7DEB787E345\
:1000400090E021E0FC01208388E390E021E0FC01C6\
:10005000208388E390E028E330E0F901308121E05B\
:100060002327FC0120838FEF9FEF9A838983898167\
:100070009A818C01C8010197F1F78C011A830983D9\
:06008000E8CFF894FFCF69\
:00000001FF";

Fixed by changing to:

const char progdata[] PROGMEM = 
":100000000EC015C014C013C012C011C010C00FC064"
":100010000EC00DC00CC00BC00AC009C008C011241E"
":100020001FBECFE5D2E0DEBFCDBF02D02AC0E8CFF1"
":100030000F931F93DF93CF9300D0CDB7DEB787E345"
":1000400090E021E0FC01208388E390E021E0FC01C6"
":10005000208388E390E028E330E0F901308121E05B"
":100060002327FC0120838FEF9FEF9A838983898167"
":100070009A818C01C8010197F1F78C011A830983D9"
":06008000E8CFF894FFCF69"
":00000001FF";

as you see this IS a bug, as the multiline is legitimate.

I don't say that the ide/compiler should permit this, but at least give a good error and not a "stack overflow"

What, exactly IS ". The \ is an escape character. It assigns special meaning to the character that follows. So, what special meaning is assigned to "? The meaning is NOT the same as ". It is that special meaning that you are inserting into the variable c, not a ".

The second assignment does insert a " into c.

I still don't see a bug in the IDE. It is properly defining different meanings to " and ".

Amen

it IS a valid escape sequence. It doesn't have sense in that contex, you are right, but compiler doesn't care; It is a escape sequence, it mean ". return. :grin:

btw as you can see from the second bug (and i think you haven't read it to say so) this overflow is breaking some "good" code, so it is a ide's bug.

btw if the IDE's start to complain about the code you write, and not the compiler, I think there is something weird going on

edit: here the "other bug", just to be sure we are talking about the same thing Google Code Archive - Long-term storage for Google Code Project Hosting.

Hi all,
I have the same problem with my sketch.
A long list of at java.util.regex.Pattern$Branch.match(Pattern.java:4604)

In my case, the problem is generated by this function of the EEPROMAnything.h library:
EEPROM_writeAnything(0, miaStruttura);

I also tried to use the library functions "avr/eeprom.h":
eeprom_write_block((const void*)&miaStruttura, (void*)0, sizeof(miaStruttura));

The struct miaStruttura is a global variable defined as follow:

struct Struttura{
int val1[4];
int val2[4];
int val3[4];
int val4[4];
char ID[8];
int ADDR;
char name[20];
} miaStruttura;

Someone can help me?
Thank you in advance!
Mik

Someone can help me?

Someone can post ALL of their code?

Hello,
thank you for the advice.
An example is my fault.

Serial.print(F("SRAM controling ... ""));

Double '' at the end of the command.
This caused the error described in the introduction to the topic.

A typo like
info("<<<" "+rxData); (3 quotes)
also causes this problem...

AndreasPercher:
info("<<<" "+rxData); (3 quotes)
also causes this problem...

Which version of the Arduino IDE are you using?