Uh oh!
There was an error while loading. Please reload this page.
Include math.h - #49
Conversation
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. Fixessparkfun#48
nseidle
commented
Dec 29, 2020
Shouldn't this be included in the header that includes the compile guards? Yes, math.h should have it's own guards but it's best practice to put math.h inside SparkFunBME280.h, no? |
jdavid
commented
Dec 30, 2020
A quick search for best practice makes me think it's the opposite: include where it's used, e.g. https://stackoverflow.com/a/3002124/9055637 But if you prefer I will move the include to the header file. |
jdavid
commented
Dec 30, 2020
e.g. in my cpp file I have: If |
nseidle
commented
Dec 30, 2020
I stand corrected! Thank you for the education. It's a simple change but I'll test this out with the other PRs later this week. |
nseidle
commented
Dec 30, 2020
Thanks again! |
No need patching anymore, sparkfun/SparkFun_BME280_Arduino_Library#49
SparkFunBME280.cppuses math functionspow,logandlog10. This produceserrors 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.his included somewhereelse. But I think it's better or more correct to include the headers for
the functions used.
Fixes#48