Control reaches end of non-void function

In my application I have included a library /#include <Sunrise.h> that I took from the WebIDE environment, but I receive an error:

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

It seems to me that this error is referring to this library item.
Would that be correct, and if so, what can I do to avoid ythis error?
Or:
is it not likely that this comes from the library item and will it be caused by my application?

1 Like

This is an error caused by the lack of a valid return statement in all possible code paths.
Previously such errors were not terminating the build process, but since they can cause unexpected behaviour in the long run the toolchain has been made stricter.

The easiest solution would be to add an unconditional return -1; before the closing brace of the function int Sunrise::Compute(unsigned char month, unsigned char day, int rs)

For the time being you'd need to copy the library sources into your own project and correct that yourself.


@BulldogLowell, any chance to correct that in the library and reupload a working library?
Issue report filed in the GitHub repo too.

3 Likes

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