Parts of code not compiling

I have an Arduino project that has been in service for over a decade, and I only recently got back into this hobby in the last month.

After upgrading to IDE 2.1.0 I believe I have found a bug.

Symptoms:
During compilation I will randomly get an error. The error might indicate a lack of a ;, or a variable that has not been declared, for example, let's sat I have the following declaration:

int someVariable = 0;

During compilation I might get an error such as:

'someVa' has not been declared.

The compiler is missing the rest of the variable name!

I can see the full variable in my code. One way around this is to highlight the affected code, cut, then paste. This clears the error.

I have encountered this problem on three different computers, on both the full install and the portable version.

It tends to do this most often at the end of the file. When I first experienced this, the error was missing '}' at the end of the program. I found I could compile if I added a redundant closing curly brace which really puzzled me.

I have found the best way around this is to add a bunch of line feeds at the end of the program.

Regards,
Magma

do you mean on v1.8.19 it compiles without any errors?

Where are the "misbehaving' sketches located? Network drive, OneDrive / Google Drive, other harddisk, ...?

The IDE copies the files to a temporary directory when verifying the sketch. This copying might fail. You can find the temporary directory if you enable verbose output during compilation in file → preferences in the IDE and analyse the output and check the files in there (the ino file will be renamed to ino.cpp.

Which operating system are you using?

Can you please post an example sketch where this happens. If the sketch consists of multiple files, you can zip them and attach.

There is no portable version of IDE 2.1. There is a ZIP but it's not portable.

1 Like

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