2.0 won’t compile

Had an issue with 2.02(?) not compiling a sketch which had several .ino in the same folder . This was a friend uploading my code , delt with over the phone , so I don’t have exact error msg .
On 1.8 compiles and uploads fine . On 2.02 it fails to compile , giving an error that it can’t find a procedure on a “sub” ino file . ( not defined)
No add in libraries used .
The sketches are very large to include here .
Not looking for a solution , but wondered if this is a known error or others have experienced it ?

This is not an issue that I have seen reported but without the actual sketch or at least the full error message it is going to be difficult to help

Possibly Arduino builder dropping a stitch; version included in 2.0.2 might have an issue that is not present in 1.8.x.

Yep I realise that - Hard to reproduce I’m afraid as I don’t use ver 2.* ( yet ) . If I was a betting man I’d suspect it was related to how it compiled - maybe the order of compilation is different or the .ino that it compiled, calling the errored procedure was ahead of the file containing that procedure .
Sorry can’t be more helpful , but not one you’ve seen before .

Not an issue for me as I’m sticking with 1.8* as I’m a late adopter !!

Can you at least get the full error message and post it here ?

I have this picture sent to me by the installer

The picture you shared is from Arduino IDE 1.x. Maybe they are using an ancient version that had the old style of EEPROM library. People often think the 2:1.0.5+dsfg version you get from APT is Arduino IDE 1.x, when really it is Arduino IDE 1.0.5.

Sorry not the picture I intended !
Can find the one from 2.* at the moment .
After this one I said to update the IDE to latest , which also failrd

I hope I haven’t mislead you guys .. this is the version2 error , which is not the same as the earlier one I presented .Apologies for that .

The screenshot of post #10 is an upload error, not the compilation error mentioned in the opening post.

Yes apologies for this . What happens when you look after Grandchildren whilst trying to post on the forum .
In my mind , whilst Peppa Pig was on, I mixed up the EPPROM error on ver 1.8 with that error on v2 .0.
Still don’t understand the version two error on the same machine ( Latte Panda) .
SORRY again guys

Although you have said that the multi tab sketch is large it really would be helpful if it were attached to a post here as a zip file so that it is easy to test in the IDE

ok will do when I get a minute

I long ago gave up on multiple .ino and now just just tabs as .h files and #include in main .ino; only downside is that sometimes I need to put on my non-Arduino hat and build my own function protypes ... seriously, I kind of appreciate this as it is sort of forced documentation and not a terrible chore.

image

1 Like

Do you put code in the .h files ?

Common wisdom is that .h is header and the .cpp is for code; but you can put everything into the .h

I know that you can do it and have done it myself but understand that it is not recommended but don't know why

I think:

  • convention from C/C++ is matching .h and .cpp
  • Arduino paradigm is to not do function prototyping

But, My personal view is to do what I want. Benefit is that by avoiding multiple .ino files, the build system do not append everything and then grind, thus changes in the main.ino does not force a large compile/link. It is in some ways like using namespaces. Once a .h is created, it is really self-contained and portable: a mini-library.

And, of course, I generally put all library code in my sketch folder:

  • avoids future hiccups because a 3rd party library got updated
  • enables a full-backup ZIP to be emailed of posted for projects

UKHeliBob

There you go .... be kind; for the puposes of upload only !

Thius is basically a charger controller for a Latte Panda board and can signal the Latte to shutdown, provide a voltage reading, whether its on charge etc etc.

  • code removed *

If you put code in a .h it can create linker errors.
This can happen if you have multiple compilation units .c or .cpp files that include a header file that has code in it. The variables and functions in the .h file end up being defined multiple times (once in the .o file for each separate compilation unit)

The linker will then complain that the variables/functions that were in the .h file were defined multiple times - which they were.

Where this gets messy and confusing is when using the Arduino IDE given the way it does its builds.
IMO, it does some goofy things that not only go against the way the embedded tools and C/C++ language works but can make things confusing and hide/mask actual issues that will show up if not using the IDE.
One of those is that it combines multiple .ino files into a single .cpp compilation unit. This can mask certain build issues one of those being related to putting code or variables in .h files depending on the structure of the sketch files, the code, and header file.
When using the IDE a guard define (which is almost always used in .h files) will usually protect against some of the issues since the IDE is building the .ino code as a single .cpp file.

The exception to all this is C++ templates.
With C++ templates the template code MUST be in the .h file.

--- bill