Skip to main content
2 of 4
deleted 103 characters in body; edited title
dda
  • 1.6k
  • 1
  • 12
  • 18

Undefined reference to stdlib (strtof)

I'm trying to run the AzureIoTProtocol_MQTT/esp8266 example, but I get linker errors:

Archiving built core (caching) in: /var/folders/fj/y3vtrz597kv4885q1b_5qypr0000gn/T/arduino_cache_934614/core/core_esp8266_esp8266_d1_mini_CpuFrequency_80,UploadSpeed_921600,FlashSize_4M3M_e1e103f2055a19e071ac9522162e1787.a libraries/AzureIoTHub/sdk/agenttypesystem.c.o: In function sscanfd': /Users/jonas/Documents/Arduino/libraries/AzureIoTHub/src/sdk/agenttypesystem.c:2826: undefined reference to strtoull' libraries/AzureIoTHub/sdk/agenttypesystem.c.o: In function sscanfllu': /Users/jonas/Documents/Arduino/libraries/AzureIoTHub/src/sdk/agenttypesystem.c:2826: undefined reference to strtoull' libraries/AzureIoTHub/sdk/agenttypesystem.c.o:(.text.CreateAgentDataType_From_String+0xac): undefined reference to strtof' libraries/AzureIoTHub/sdk/agenttypesystem.c.o: In function CreateAgentDataType_From_String': /Users/jonas/Documents/Arduino/libraries/AzureIoTHub/src/sdk/agenttypesystem.c:3571: undefined reference to `strtof' collect2: error: ld returned 1 exit status

The issue can be broken down to the call to strtof function call. I get the same error with only this very simple code snippet:

#include <stdio.h>

void setup() {
  char szOrbits[] = "686.97";
  float f;
  f = strtof (szOrbits, NULL);
}

void loop() {
}

Tested environment: Mac OS X 10.13.2 with Arduino 1.8.3 AND Windows 10 with Arduino 1.8.5.