Skip to content

SparkFunBME280.cpp:410:37: error: ‘pow’ was not declared in this scope #48

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

Closed
jdavid opened this issue Oct 23, 2020 · 0 comments · Fixed by #49
Closed

SparkFunBME280.cpp:410:37: error: ‘pow’ was not declared in this scope #48

jdavid opened this issue Oct 23, 2020 · 0 comments · Fixed by #49

Comments

@jdavid
Copy link
Contributor

jdavid commented Oct 23, 2020

There are several calls to math functions (pow, log, log10) but math.h is not included.

This is not an issue with Arduino probably because math.h is included somewhere else. But I'm trying to use this library with RIOT-OS, which has an Arduino compatibility module and I get a number of errors like:

error: ‘pow’ was not declared in this scope

For now I'll have to apply a patch, but it would be cool to be able to use this library without modifications. This is the patch I'm going to use:

--- SparkFunBME280.cpp	2020-10-23 18:52:48.971574912 +0200
+++ SparkFunBME280_math.cpp	2020-10-23 19:08:15.968040892 +0200
@@ -20,6 +20,7 @@
 ******************************************************************************/
 //See SparkFunBME280.h for additional topology notes.
 
+#include <math.h>
 #include "SparkFunBME280.h"
 
 //****************************************************************************//
jdavid added a commit to spectraphilic/SparkFun_BME280_Arduino_Library that referenced this issue Oct 24, 2020
SparkFunBME280.cpp uses math functions pow, log and log10. This produces
errors such as "pow was not declared in this scope". Found this while
packaging this library for RIOT-OS.

The library works with Arduino because math.h is included somewhere
else. But I think it's better or more correct to include the headers for
the functions used.

Fixes sparkfun#48
@jdavid jdavid mentioned this issue Oct 24, 2020
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