Sunrise library Photon compile error

My Photon weather station code used to compile OK. Now I'm getting:this error from the Sunrise library:

lib/Sunrise/Sunrise.cpp:101:1: control reaches end of non-void function [-Werror=return-type]

Add a return statement to the end of the function that's flagged.

Or target an older version of Device OS. Older versions did not flag this as a compile error, but would instead sometimes crash with a SOS+1 panic at runtime, so the compile error is generally better.

1 Like

Um, how do I do that? I'm not able to edit the library. I see in this thread: https://community.particle.io/t/how-to-edit-comunity-library-files-in-web-ide/31886 that scruffR says:

You can’t edit the library in Web IDE unless you have all the files present as individual file tabs, but there is no easy way to do that.
You’d need to manually copy-paste the code.

but he doesn't say how.. I get the copy part, but paste into what? My existing code? A new empty window? Then do I need to change my include statements?

Anyway if I may suggest, the right fix would be to edit the library itself so the next person who comes along doesn't hit this problem.

UPDATE

I ended up just pasting the entire Sunrise code into my program, adding a return statement right before the very last closing bracket in Sunrise.cpp, and removing the library from my list of installed libraries. Now it compiles OK. But it still seems to me the right way to fix this is to edit the library itself. Absent locating the original author, is there no way to do this?

I can't really mark this as solved, more like "worked around".

For simple libraries, that is the best solution if you need to use the Web IDE.

There's more information on modifying a public library to the library guide.

1 Like

Thanks. Looks complicated :slight_smile: I guess I'll try making a fork - once I get the rest of this weather code running again.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.