Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need function declarations in examples #22

Open
jenesaisdiq opened this issue Mar 14, 2017 · 2 comments
Open

Need function declarations in examples #22

jenesaisdiq opened this issue Mar 14, 2017 · 2 comments

Comments

@jenesaisdiq
Copy link
Contributor

Hey @mohitbhoite, I was finally testing the ublox branch and got compile errors on the first example (and I'd expect the others to throw it as well). The errors are that transmitMode, batteryStatus, and gpsPublish are undeclared when Particle.function tries to reference them. Fixed easily by adding these up above setup()

int transmitMode(String command);
int batteryStatus(String command);
int gpsPublish(String command);

This was in Dev. Maybe something's different in Build, or because I was using 061rc2? Worth adding them to all the examples.

@MrMarkA
Copy link

MrMarkA commented Mar 14, 2017

I noticed this sometime ago as well. When using the desktop tools (i.e. Atom) C style forward declarations are required. When using the browser based tools(build.particle.io) forward declarations are not required. I have not messed around with the CLI build tools so that remains up in the air.

An alternate solution would be to move the functions (transmitMode, batteryStatus, and gpsPublish) above setup and loop. I am sure some would find that solution stylistically problematic.

@jenesaisdiq, you will probably also discover that any functions you add to the code will either need to have the forward declarations or be be fully defined before the function is first called in the code.

@monkbroc
Copy link
Member

I'm sure if you try again it will be fixed. I pushed a fix to the preprocessor today for this very behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants