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

Compilation fails because of missing default return value #9

Open
pe1rmg opened this issue Sep 30, 2023 · 0 comments · May be fixed by #11
Open

Compilation fails because of missing default return value #9

pe1rmg opened this issue Sep 30, 2023 · 0 comments · May be fixed by #11

Comments

@pe1rmg
Copy link

pe1rmg commented Sep 30, 2023

I am using Arduino IDE 2.2.1 and when compiling the example sketch I get the following error:

/Users/pe1rmg/Documents/Arduino/libraries/LTC2942/src/LTC2942.cpp: In member function 'uint8_t LTC2942::findExponentOfPowerOfTwo(uint8_t)':
/Users/pe1rmg/Documents/Arduino/libraries/LTC2942/src/LTC2942.cpp:195:1: error: control reaches end of non-void function [-Werror=return-type]
  195 | }
      | ^
cc1plus: some warnings being treated as errors

exit status 1

Compilation error: exit status 1

I have solved this by adding "return 0;" at line 195, so there is a default return value, even when it will never reach the default return.
Maybe you can add this in your library to make it compatible with the current Arduino IDE compiler settings?

Thanks!

jdavid added a commit to jdavid/LTC2942-Arduino-Library that referenced this issue Mar 7, 2024
Fixes MacroYau#9

[...]/LTC2942.cpp: In member function 'uint8_t LTC2942::findExponentOfPowerOfTwo(uint8_t)':
[...]/LTC2942.cpp:195:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1plus: some warnings being treated as errors
@jdavid jdavid linked a pull request Mar 7, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant