Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By torntrousers
#16610 Converting some Arduino code for ESP8266 and i've a compile error i can't work out with a pow function. A sketch demonstrating it is:
Code: Select allconst float sea_press = 1013.25;

void setup() {
}

void loop() {
}

float getAltitude(float pressure, float temp) {
//  return ((pow((sea_press / pressure), 1/5.257) - 1.0) * (temp + 273.15)) / 0.0065;
  int p = (sea_press / pressure);
  //p = 7; 
  return ((pow(p, 1/5.257) - 1.0) * (temp + 273.15)) / 0.0065;
}


which gives:
sketch_may05b.cpp.o: In function `loop':
sketch_may05b.cpp:(.text+0x38): undefined reference to `pow'
sketch_may05b.cpp.o: In function `getAltitude(float, float)':
sketch_may05b.cpp:(.text+0x82): undefined reference to `pow'
collect2.exe: error: ld returned 1 exit status
Error compiling.

Uncomenting the p=7 line then it works fine, and it works fine changing the board type to be an Uno.

Any ideas how to get this to compile?