Workspace chaos!

I think I might know what’s happened here.

You renamed the *.ino file to *.cpp in the imported sketch folder and everything stopped compiling?

If so, add this line to the top of the file formerly known as *.ino:

#include "Arduino.h"

The letter case is significant by the way, upper case ‘A’.

Do a “clean” – click the dustbin/trashcan icon in the toolbar at the bottom, then do a normal build and it should work.

The problem is down to you renaming the file. With *.ino, PlatformIo – somehow – compiles in the same way as the Arduino IDE. After renaming to *.cpp it compiles as a plain C++ file, so it (the C++ compiler) has no idea what a pinMode() function is, for example. Adding in the Arduino.h file informs the compiler about these things in use in the Arduino “Language”.

I wrote a small tutorial on importing and converting a multi-ino Arduin Sketch to C++ which might be of interest/use in attempting to explain what goes on?

HTH

Cheers,
Norm.

1 Like