Undesired CPP file

Hello Particle Community,

During the early stages of product development we are switching from the Web IDE to the Particle Workbench within VS Code. I am now using the command, Particle Cloud compile and then Particle flash --local .\boron_firmware_###, with the ### represents the numbers the compiler assigns to the bin file.

Currently I have an issue where a .cpp file is autogenerated from the ino file. This often results in a successful binary upload to the board but essentially an empty loop(). Once I delete .cpp files from the parent and src folders, my BIN file compiles correctly.

I am using a Boron with VS Code with device OS 5.6.0.
I would like to correct the root cause, and has caused me two full days of developer debugging.
Thank you., why does this happen?
-Mike

You can drop the .ino file and only work with the .cpp file.
Without the .ino the preprocessor has no need to create the "intermediary" .cpp.

1 Like

Hi @ScruffR ,
Interesting you mention that, I deleted all the .cpp files in the same directory and subdirectories. After these were deleted there were no issues.

Is it basically a one or the other type of scenario?

Thanks,
Mike

AFAICT when you have a .ino file each time you build locally the local preprocessor creates a .cpp file from that and the local compiler will only deal with this file and not touch the .ino file, but you will end up with both in your file structure.

On the other hand, when you start off from a .cpp file there is no need to back-process that into an .ino and so you will not get one.

1 Like

Why would the ino file then compile without the CPP?

The cloud compilers transparently convert the ino to cpp. The same operation is done, but the file is not saved locally.

The local compiler needs to save the file on the file system for the local compiler to be able to use it, so you get both.

As ScruffR said, it's best to just use cpp files and never use ino files. See preprocessor.

1 Like