adding symbols: Malformed archive

Hi Guys,

II’m trying to convert float to array char.

I’m having an problem as the error message below

c:/program files (x86)/arduino/hardware/tools/avr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/lib/avr5\libc.a: error adding symbols: Malformed archive

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Pro or Pro Mini.

Below is my code
#include <Arduino.h>

void setup() {
// put your setup code here, to run once:
char buffer[8];
float yaw =123.12;
String s = dtostrf(yaw, 180, 1, buffer);

Any idea?

There needs to be a loop() function in your sketch.

Strange error message though, that.

This is just a simple code for convert the float to char array.

If this work, will then integrate to my application code which get pitch roll yaw from IMU then publish the pitch to PC via BLE. The BLE communication code that accept char array.

String s = dtostrf(yaw, 180, 1, buffer);

This looks whacky

You specify that the minimum width of the output should be 180 (why ?) but use a buffer of 8 characters, then compound the problem by assigning the result to a String when you almost certainly don’t need to.

As a start try reducing the width parameter to 7 or less

Whacky strings notwithstanding, if I add an empty loop function it compiles just fine for me (MacOS 10.13 / Arduino 1.8.7)


Attached picture of the error message. I put in the loop but same thing for me.
I running on window 10 64bit , arduino 18.7

Why a picture rather than copy the error message and post it here in code tags ? Your picture even shows the very convenient "Copy error messages" button

I suspect this has nothing to do with the code but instead is caused by a corrupted installation of the Arduino IDE (actually the avr-gcc tool bundled with the IDE). Try uninstalling and then reinstalling the Arduino IDE.