Compile Error when building new app

I have successfully compiled a project (app), verified flashed and works. Created another app under web IDE which gives me compile errors for pretty much everything defined under .h file. Both projects are identical except the name of .ino file and some publish definition (solar_parking is changed to FF_parking). I must me missing something here in creating new app.

I want to attach the codes but I do not see any option here for attachments…

Can someone please help?
Thanks.

You can use the SHARED THIS REVISION button and post the resulting link.

BTW, with .h and .cpp files you need #include <Particle.h> and no blanks are allowed in the filename (just in case you didn’t actually type _)

Thanks.
So, you are saying that I need to include particle.h in both the .h and .cpp files?

Here is the one that works:
https://go.particle.io/shared_apps/5ac6fdc61a8772763700159d

Here is the one that gives errors:
https://go.particle.io/shared_apps/5adf3fd7cdc59cf0a10000fc

Thanks.
Regards.

Not exaclty that. If you have #include <Particle.h> in the .h which you inlcude in your .cpp file then that’s enough.
Or if you don’t use any datatypes or other terms in your header that would only be declared via Particle.h then you can get away with only including it in .cpp.

About your errors.
You are declaring a class RelayShield but nowhere implementing the respective methods.
You are implementing methods that are called the same, but to make them part of the class you’d need to delcare them as e.g. void RelayShield::begin(void)

And the actual difference between the two versions is that the working one also imports the official RelayShield library while the other one doesn’t.

Also the empty .ino file but having the active code in .cpp comes across somewhat onorthodox :wink:

BTW, about Particle.h - you have application.h there which was the predicessor of the now favoured Particle.h

Thanks for your valuable inputs and fast response.
I will optimize the code based on your feedback.
You mentioned that the working one imports official Relayshield library. Can you please point me where is that done? Both codes seem the same to me for relayshield definitions.

If you open the </> code flyout (where you also found the SHARE THIS REVISION button, you’ll see the difference between the two versions.

To import a library (which you must have done already for the working project) you can follow the docs Guide secion
https://docs.particle.io/guide/getting-started/build/photon/#using-libraries

I see. I am currently using secured and outdated version of internet explorer and thus don’t even see the included libraries field. I will check that out when I go home and use proper browser.

Thank you for all your help.
:slight_smile: