Why is the extension on the code file names end it .ino on the build ide? I would expect the file extension to be .cc or .cpp since the programming language supported on the build ide is C++?
Particle shares ties with Arduino, so it uses the .ino extension for code. You can write your code in .cpp files too though.
That’s very good news for me!
Its actually renamed to cpp during compile, which gives some interesting errors if you have a file named xyz.ino and a file named xyz.cpp since the particle compiler does not detect this, and you get the raw error from the linker
There is a difference too in that .ino files have the Arduino-style preprocessor applied to them, so you don’t have to have function prototypes and lots of other simplifications, but .cpp files do not. When the preprocessor is not used, you typically need to do
#include "application.h" in order to access all of the wiring functions such as pinMode() and digitalWrite().
Sadly at the moment the WebIDE doesn’t support renaming or creating as .cpp. As a Linux user this only leaves the particle-cli for .cpp based projects at the moment.
The web IDE does support adding C++ files via the small circle plus on the right hand side top of the window. Hitting that button creates an empty .cpp and .h tab in your project.
It is true that you must have a .ino file in your web IDE project, but I think it can be empty if you provide a setup() and loop() in C++ with the proper
extern "C" declarations.
Do you have to have a .ino file with my .cpp file in Particle Dev?
Hey that’s alright. On my Linux box, I use Atom alongside terminal with particle-cli.