Still a lot of "undeclared" Arduino keywords

I like to use the new IDE 2.0 (beta7) because of the significantly shorter compilation time compared to 1.8.x.
But the fact that e.g. Serial and delay are still undeclared is not exactly praiseworthy for an Arduino IDE.
Undeclared

If Serial and delay were undeclared you would not be able to use them. Is that what you are saying ?

What are your settings, for which board, can you give a sketch as text that we can try ?

OK: The answers remind me of the "Saint Thomas": I do not believe what I do not touch (see). The attached sketch is compiled for the Arduino Nano. And everything works fine !! It's a flaw in the IDE.

/*===============================================================
	Blink sketch for viewing with a normal multimeter
	---------------------------------------------------------------
	Sketch: Blinken.ino
	Author: Rudolf Schenke
	Update: 21.05.2021
	===============================================================*/

#define pinLED 13
int counter;
#define PAUSE 2000

//==== Arduino Standard: setup() =========================
void setup() {

	Serial.begin(38400);
	while(!Serial) delay(10);
	Serial.println("Hello from M0 mini! It shold blink at pin 2");

	pinMode(pinLED,OUTPUT);
}

//==== Arduino Standard: loop() ==========================
void loop() {

	digitalWrite(pinLED,HIGH);
  Serial.print('H');
	delay(PAUSE);
	
	digitalWrite(pinLED,LOW);
  Serial.print('L');
	delay(PAUSE);

  if (counter++ == 20)
  {
    Serial.println();
    counter = 0;
  }
}

This is a part of a screendump of what I am seeing:
beta7
Is there something wrong with it ?

This information is coming from the Arduino IDE 2.x via the Arduino Language Server, which is a separate system from the compiler. So you can get spurious problem reports from the language server even when the compiler is perfectly happy with your sketch.

There are quite a few reports of this sort of thing here on the forum and in the GitHub issue tracker:
https://github.com/arduino/arduino-ide/issues?q=is%3Aissue+is%3Aopen+label%3A"topic%3A+language+server"

So this type of problem is definitely something the developers are aware of. I think that the language server will improve over time, but my experience with other language servers that have far more development resources indicates that there will always be some occasional spurious results.

Any experienced user will be able to interpret the results and easily ignore the spurious ones, so they will still find the language server "problem matcher" integration to be a valuable feature. I'm not yet convinced that the benefits will outweigh the harm for beginners though.

Definitely the best approach to take in this sort of situation.

Do you mean the classic ATmega328P-based Nano? There haven't been as many reports of language server problems with the classic AVR boards. Is that the board you had selected while you were getting the spurious problem matchers from the language server? I see your sketch mentions the M0 Mini.

As I thought

They are not actually undeclared

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.