Arduino IDE problem - showString( )

Some weeks ago I decided to become familiar with the Arduino IDE method for updating an emonTx firmware/sketch.

I installed it on my Windows laptop together with the required Libraries.

I was successful in burning the latest 3 phase sketch with Calibration constants which I had determined after a few experiments. It all worked perfectly well.

Today I decided to further adjust the Calibration constants and made the necessary changes to the src.ino file.

I expected the updating process to be as simple and straightforward as previously but it was not …

When running Arduino IDE Verify, I get the following error messages …

~~\src\config.ino: In function ‘void readInput()’:

config:165:25: error ‘showString’ was not declared in this scope


Then a similar error …

In function ‘bool config(char)’:

config:239:29: error ‘showString’ was not declared in this scope


I am at a loss to understand as I’m using the same procedure that worked a few weeks ago.

I’m using SERIALOUT (line 74 of src.ino) and notepad ++ to make changes to & save files.

Searching the Forum for config.ino, I found nothing relevant except for a ‘Much improved version by Robert Wall #6’. I tried this but it still threw errors on Verify.

Any suggestions/help – most welcome

John Banks

Is the showString(…) function still present in the config.ino file (right at the bottom), or has it been accidentally edited out?

I too use NP++ (in preference to the in-built editor), so that in itself is not the culprit.

The correct config.ino was bundled with the main sketch, along with the documentation, in a zip file - I believe all the contents thereof have since been separated - I know not why, so maybe someone had married the wrong config.ino to the sketch.

Here’s the distribution as it left me: (216.0 KB)

Robert …
Thx for yr incredibly fast response.
Your zipped config.ino looks similar to the one I was using.
However I have just tried yr zipped version.
Unfortunately - I get the same showString errors.
Thx again - it’s late - I’m to bed

As a cross-check, I tried compiling the sketch. No errors.
FWIW, I get the same errors the OP gets (line number references)
if I comment out the showString function. (config tab)

That figures, as the error message means it can’t find the definition of the function. (The Arduino IDE doesn’t require a declaration of the function, like most compilers.)

Which begs the question:
You haven’t loaded any other IDE, have you? Because there’s one, heavily promoted, which screwed up badly and moved directories and files around when I tried it out. And that could easily cause untold errors.

In the Arduino IDE, have you got 3 tabs and 3 files:
“emonTx_3Phase_PLL”, “config” and “rfm”?
Those 3 files all need to be in the same directory, called “emonTx_3Phase_PLL”

And have you disabled the internal editor in the Arduino IDE? (File → Preferences → Settings → Use external editor)

I trust you know about the “Compare” plug-in for NPP?

It works for you guys and it worked for me a couple of weeks ago.

I figured it must be my Arduino IDE installation or the way I’m using it so …

So I’ve re-installed Arduino IDE (now 1.8.7) and the Libraries - jeelib, emonlib,one wire & Dallas temp.
I used Robert’s zipped files (above) - unzipped them then had to remove ‘_v1.2’ from the folder name to get the 3 tabs and 3 files.
I made no other changes except for Preferences - verbose, line numbers and external editor.

I ran Verify but still got the same showString errors on lines 165 & 239 of config.ino

Do I need helpText1?
If viable - which lines should I delete from config.ino to work around this problem?

PS - I’ve also installed the Compare plugin for Notepad ++

There must be something about your installation that isn’t quite right.

This is a long shot:
Look through the Arduino installation instructions in Learn Learn | OpenEnergyMonitor and especially Learn | OpenEnergyMonitor just in case there’s something not in the correct place, though I don’t see how that would account for the error you’re seeing.

It comes back to the compiler can’t see the function:

static void showString (PGM_P s) {
  for (;;) {
    char c = pgm_read_byte(s++);
    if (c == 0)
    if (c == '\n')

yet it must be reading and parsing the file to generate the error message.
There has to be something wrong in the file above that function definition that’s preventing the compiler from finding it.
I’m using V1.8.1 under Ubuntu Linux, but I can’t see anything in the release notes that might be relevant.

You do want showString, because it gives you the help text for configuring & saving to EEPROM. If you can’t get it to work, commenting those two lines that throw the error should get you going.

In an attempt to get going, I commented out lines 165 & 239 in config.ino with the following result …
config .ino then threw an error at line 240

I then commented out line 240 and things progressed a bit …
emonTx_3Phase_PLL.ino threw errors at lines 370, 472 & 868
config.ino threw a new error at line 274
and rfm.ino threw an error at line 151

As I am not using Radio, I modified emonTx_3Phase_PLL.ino with my specifics …
Line 98 node 13
Line 123 // commented out as CT4 not used
Line 125 // commented out for normal LED behaviour
and Line 133 changed to 45 as CT4 not used

Things progressed a bit further and I now got the following errors …

Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\johnb\Documents\Arduino\emonTx_3Phase_PLL\emonTx_3Phase_PLL.ino: In function ‘void loop()’:

emonTx_3Phase_PLL:472:18: error: ‘getCalibration’ was not declared in this scope



C:\Users\johnb\Documents\Arduino\emonTx_3Phase_PLL\config.ino: In function ‘bool config(char)’:

config:274:1: error: a function-definition is not allowed here before ‘{’ token



config:379:1: error: expected ‘}’ at end of input



exit status 1

‘getCalibration’ was not declared in this scope

Do I need getCalibration() ? - if not, which lines should I comment out ?

Do you have any further suggestions regarding the 2 errors still thrown by config.ino

Or has my commenting lines created a vicious circle of errors?


Can you upload a zip of the source files you’ve edited? Maybe give it a name of “” so it doesn’t confuse others who may find it in future and think its a working version.

I think you’ve possibly taken too much out.
When you edited line 240, you should have left an empty statement after the default: condition, i.e.

    } //end switch

should become

    } //end switch

Yes, that semicolon is an empty statement. (Without it, the compiler got lost, which provoked the other errors.) Then restore everything you did after that, and see where we are. If it still complains that getCalibration is not declared, we’re back to the original problem again, because by removing showString, all we’ve done is move the problem a bit further on, but it’s still the case that the config.ino file is not getting read properly and the functions in it aren’t being found.

I’m going to download the same version of the IDE shortly and install that, and see what happens.

In response to @Greebo here’s the requested zip file … (235.1 KB)

I’ll now try Robert Wall’s latest suggestions

And thank you all for your help

Having just installed Arduino IDE V1.8.7:

… In function ‘void readInput()’:
config:165:29: error: ‘showString’ was not declared in this scope

So it’s NOT you and it’s NOT my sketch - it’s the IDE.
Can you revert to V1.8.1 - which is the version I was using?

Next question: Why? and what can be done about it? It won’t be good to consolidate everything into the one file, but that’s probably the work-around.

All it needs is a declaration of showString, in the main file:

static void showString (PGM_P s);

I usually insert those just above the first executable statement, viz:

OneWire oneWire(W1PIN);

static void showString (PGM_P s);

void setup()
... etc

Now why does this version need it, and V1.8.1 didn’t, and why does it not need definitions of all the other functions in the supporting files?

Methinks it’s a bug. In previous versions, the definition sufficed.

1 Like

Robert …

My problem is now solved with your updated sketch.

(See: Update to 3-Phase PLL sketch - a separate posting on this Forum)

I’ve successfully uploaded the revised sketch incorporating my particular changes (SERIALOUT, node number, etc).

Many thanks for your speedy diligence

The newer IDE appears to compile more efficiently, but importantly the declaration of showString( ) doesn’t generate an error in the older IDE V1.8.1.

Hopefully my travails and your efforts will be of benefit to others.
And I do hope a way is found to make the latest versions of sketches more readily accessible in the RESOURCES section of the website - that would benefit others too.

1 Like