Go Down

Topic: "#Define Version" bombs Arduino12 editor. (Read 2161 times) previous topic - next topic


I've been looking for a low cost microprocessor with free C++ support for years and I'm chagrinned that it took me so long to find the Arduino community but I've now become instantly addicted and I thank everyone for all the effort they've put in.

I created a little test sketch with a class member that returned a version string, added it as a library and then added "Version LITERAL" into the keywords.txt file. That all went well and worked just fine, but I was using Arduino11 at the time.
I then switched to Arduino12 and created a few more sketches and libraries and recently returned to modify my test sketch only to find that the Arduino12 editor would blank out most of the source.  I eventually traced it down to the combination of:

1 - A "Version LITERAL" line in one of my keywords.txt files (not even referenced by the failing sketch).

2 - A "#define Version" statement in the working sketch. (Actually "//#define Version" works fine while "/#define Version" and "#define Version" both fail and it has to be Version with a capital V.)

3 - Moving the cursor over the "#define Version" line in the sketch.

Those three conditions result in much of the edit screen going blank with the text lines reappearing as the cursor is moved up or down and disappearing if the screen is scrolled. Arduino11 is fine and this only happens with Arduino12.  In a Windows XP system, by the way.

The fix is easy: Don't use "Version" in a define statement or if you do, don't put it in any keywords.txt file.
So the problem isn't critical and I only post it in case someone else might by pulling their hair as the editor goes crazy.

- Pat

Go Up