[solved] The Arduino compiler drives me crazy...

I am working on a quite large program continuously since months.

Suddenly on the part of the program that I have touched for a very long time, I get a warning error:

exit status 1
'printTab' was not declared in this scope

The error comes on that statement:

   case 'M':                      //Serial Report
    case 'm':
      if (settings.reportType == 'M')           //Report voltages and breakpoint counts
      {
      Serial.print("Vcc=");      Serial.print(Vcc / 1000);   printDot();     Serial.print(Vcc % 1000);   printTab();    Serial.print("°C=");      Serial.print(Temp / 10);     printTab();    
      Serial.print("A0Raw=");    Serial.print(A0Raw);        printTab();     Serial.print("10ms=");     Serial.print(amount10ms);   printTab(); Serial.print("100ms=");   Serial.print(amount100ms); printTab();

the functions are correctly declared at the very end of the sketch:

void printDot()    // Print "." on Serial
{
Serial.print('.');   
}

void printTab()   // Print a " | " on Serial
 {
Serial.print(" | ");   
 }

void prSp()
{
Serial.print(' '); //Print a " " on Serial    
}

void prLe()
{
Serial.print('<'); //Print a "<" on Serial    
}

Why doesn’t the program accept printTab(), when it accepts printDot()?

I have tried to rewrite manually both parts of the code, the print statements and the function declaration, and I cannot get rid of that error.

Has someone got a clue on what to do or what to try?
Thank you very much.

The Arduino IDE is V1.8.10.

Without seeing your full code, I can only speculate:

It could be caused by a missing or misplaced closing brace. If so, doing a Tools > Auto Format will cause the printTab() function definition to be unexpectedly indented.

It could be caused by a failure of the Arduino sketch preprocessor's function prototype generation functionality. If so, manually adding a prototype for the function at the top of your sketch will fix the error:

void printTab();

pert:
Without seeing your full code, I can only speculate:

It could be caused by a missing or misplaced closing brace. If so, doing a Tools > Auto Format will cause the printTab() function definition to be unexpectedly indented.

It could be caused by a failure of the Arduino sketch preprocessor's function prototype generation functionality. If so, manually adding a prototype for the function at the top of your sketch will fix the error:

void printTab();

Thank you for the fast help.
The full code ist tabbed and quite long.
Putting the functions at the beginning solves that problem, but throws other errors.
So it should be a cruly brace error, searching where now...

Another useful feature of the Arduino IDE/Arduino Web Editor for troubleshooting braces problems is that when you place the cursor next to one bracket, it puts a box around the matching bracket. In the Arduino IDE, if the cursor is next to the closing bracket and the opening bracket is off the screen then it will show the opening bracket line in a tool tip after a short delay.

It is a shame that the facility to double click next to a bracket and have the text between it and the associated bracket selected was removed from the IDE at some point

There is an undocumented keyboard shortcut: Ctrl + { that jumps you from one bracket to the matching one. Not as useful as the double click feature, but maybe it will help.

void printDot()    // Print "." on Serial
{
Serial.print('.');   
}

void printTab()   // Print a " | " on Serial
 {
Serial.print(" | ");   
 }

void prSp()
{
Serial.print(' '); //Print a " " on Serial   
}

Did you put that space before "{" and "}" of printTab() ? If "no" then something is wrong there.


edit
move printTab function after prSp. Where is the error now?

...and something else.
usually the "not declared..." error come at the line that the function is called from.
Check the error again. Does it say "printTab()" or (perhaps) printab(), prinTab() etc?
Copy-paste the error in the discussion

Post your complete code (in code tags) even in 2 parts.

GRuser:
[Solved]

So it should be a curly brace error, searching where now...

I finally found where that silly missing brace was.

It was confusing, that printDot() did not throw an error, but printTab() did.
The very reason for that was that printDot() was invoked before in setup and printTab() not.

thank you for your help
regards
Laszlo

pert:
There is an undocumented keyboard shortcut: Ctrl + { that jumps you from one bracket to the matching one. Not as useful as the double click feature, but maybe it will help.

I finally took the habit of commenting each } embracing more than 10 lines with
// end (condition] in the next line, so when I collapse the brace I can see if the end matches.

RIN67630:
It was confusing, that printDot() did not throw an error, but printTab() did.

it is not confusing. The missing “}” caused printTab() to be “something” inside PrintDot (and not a function). When you call it, compiler does not see it.
But the error is at the calling line and not at the declaration.

That simple.

This does not quite work as intended.
What does it print when Vcc is 2095?

  Serial.print("Vcc=");     
  Serial.print(Vcc / 1000);
  printDot();     
  Serial.print(Vcc % 1000);

oqibidipo:
This does not quite work as intended.
What does it print when Vcc is 2095?

  Serial.print("Vcc=");     

Serial.print(Vcc / 1000);
  printDot();   
  Serial.print(Vcc % 1000);

2.095 as it should.

Try again.

Programmers use text editors that know how to align braces so they match, which makes errors obvious. Remember the compiler ignores whitespace and indentation completely (its not like the Python language for instance).