snugRugBug

I'm relatively new to everything here, but I've been spending a lot of time developing some sketches, and, until now, everything's been working fine.

For some reason the attached sketch cannot finish compiling. The little progress bar only gets to about 20%, and the compiler gives an error that starts with "Exception in thread "Thread-4256" java.lang.StackOverflowError", and is followed by hundreds of lines starting with "at java.util.regex.Pattern$".

It looks like this:Exception in thread "Thread-4256" java.lang.StackOverflowError at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344) at java.util.regex.Pattern$Branch.match(Pattern.java:4114) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168) at java.util.regex.Pattern$Loop.match(Pattern.java:4295) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227) at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078) at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345) at java.util.regex.Pattern$Branch.match(Pattern.java:4114) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168) at java.util.regex.Pattern$Loop.match(Pattern.java:4295)... and it goes on and on and.

Please take a look and see if I'm missing something. I lack experience Please note: a lot of the code is copied from previous sketches.Oh, and it's still a work in progress, not a polished piece of machinery

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.

snugRugBug

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.

snugRugBug

snugRugBug

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.

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 , we will see.btw if you don't know what is a regex: http://en.wikipedia.org/wiki/Regular_expression

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.

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.

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: http://code.google.com/p/arduino/issues/detail?id=962