<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MySensors library 1.4 fails to compile when run on RPi (solved)]]></title><description><![CDATA[<p dir="auto">Hey,</p>
<p dir="auto">I am new with the MySensors library, and I just installed it on my Raspberry Pi, where I have the Arduino framework (1.0.1) as well. I was going to try out some of the examples using the Arduino IDE, but for some reason it seems that the library fails to compile when I try to verify the code. When running for example the BatteryPoweredSensor example the compiling fails to the following error:</p>
<pre><code>avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/SPI -I/home/pi/sketchbook/libraries/MySensors /tmp/build469947204035938533.tmp/BatteryPoweredSensor.cpp -o /tmp/build469947204035938533.tmp/BatteryPoweredSensor.cpp.o 
BatteryPoweredSensor.cpp: In function ‘void loop()’:
BatteryPoweredSensor.cpp:30:8: warning: unused variable ‘sensorValue’ [-Wunused-variable]
  Using previously compiled: /tmp/build469947204035938533.tmp/SPI/SPI.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/MyMessage.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/MySensor.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/MyGateway.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/MyMQTT.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/utility/LowPower.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/utility/MsTimer2.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/MySensors/utility/RF24.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/wiring_analog.c.o
  Using previously compiled: /tmp/build469947204035938533.tmp/wiring_pulse.c.o
  Using previously compiled: /tmp/build469947204035938533.tmp/wiring_digital.c.o
  Using previously compiled: /tmp/build469947204035938533.tmp/wiring_shift.c.o
  Using previously compiled: /tmp/build469947204035938533.tmp/wiring.c.o
  Using previously compiled: /tmp/build469947204035938533.tmp/WInterrupts.c.o
  Using previously compiled: /tmp/build469947204035938533.tmp/HardwareSerial.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/USBCore.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/Stream.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/main.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/HID.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/WString.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/WMath.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/IPAddress.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/new.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/Print.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/Tone.cpp.o
  Using previously compiled: /tmp/build469947204035938533.tmp/CDC.cpp.o
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/wiring_analog.c.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/wiring_pulse.c.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/wiring_digital.c.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/wiring_shift.c.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/wiring.c.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/WInterrupts.c.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/HardwareSerial.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/USBCore.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/Stream.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/main.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/HID.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/WString.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/WMath.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/IPAddress.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/new.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/Print.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/Tone.cpp.o 
avr-ar rcs /tmp/build469947204035938533.tmp/core.a /tmp/build469947204035938533.tmp/CDC.cpp.o 
avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build469947204035938533.tmp/BatteryPoweredSensor.cpp.elf /tmp/build469947204035938533.tmp/BatteryPoweredSensor.cpp.o /tmp/build469947204035938533.tmp/SPI/SPI.cpp.o /tmp/build469947204035938533.tmp/MySensors/MyMessage.cpp.o /tmp/build469947204035938533.tmp/MySensors/MySensor.cpp.o /tmp/build469947204035938533.tmp/MySensors/MyGateway.cpp.o /tmp/build469947204035938533.tmp/MySensors/MyMQTT.cpp.o /tmp/build469947204035938533.tmp/MySensors/utility/LowPower.cpp.o /tmp/build469947204035938533.tmp/MySensors/utility/MsTimer2.cpp.o /tmp/build469947204035938533.tmp/MySensors/utility/RF24.cpp.o /tmp/build469947204035938533.tmp/core.a -L/tmp/build469947204035938533.tmp -lm 
MySensors/MySensor.cpp.o: In function `MySensor::freeRam()':
/home/pi/sketchbook/libraries/MySensors/MySensor.cpp:586: undefined reference to `operator new[](unsigned int)'
collect2: error: ld returned 1 exit status
</code></pre>
<p dir="auto">I simplified the source to see if it's a specific call that would cause the issues, but it doesn't seem that way. The source that I am using is pasted under.</p>
<pre><code>// This is an example that demonstrates how to report the battery level for a sensor
// Instructions for measuring battery capacity on A0 are available in the follwoing forum
// thread: http://forum.micasaverde.com/index.php/topic,20078.0.html

#include &lt;SPI.h&gt;
#include &lt;MySensor.h&gt;

int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point

MySensor gw;
unsigned long SLEEP_TIME = 900000;  // sleep time between reads (seconds * 1000 milliseconds)
int oldBatteryPcnt = 0;

void setup()  
{
   // use the 1.1 V internal reference
   analogReference(INTERNAL);
   gw.begin();

   // Send the sketch version information to the gateway and Controller
   gw.sendSketchInfo("Battery Meter", "1.0");
}

void loop()
{
   // get the battery Voltage
   int sensorValue = analogRead(BATTERY_SENSE_PIN);
   gw.sleep(SLEEP_TIME);
}
</code></pre>
<p dir="auto">Anyone have any ideas how to get the library working?</p>
]]></description><link>https://forum.mysensors.org/topic/1025/mysensors-library-1-4-fails-to-compile-when-run-on-rpi-solved</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 00:44:22 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/1025.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Feb 2015 09:25:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MySensors library 1.4 fails to compile when run on RPi (solved) on Mon, 23 Feb 2015 13:32:17 GMT]]></title><description><![CDATA[<p dir="auto">Alright,</p>
<p dir="auto">I figured it out. It was no more complicated than updating the Arduino IDE and the avr-gcc compiler from the outdated versions (Arduino IDE 1.0.1) automatically installed by the apt-get.</p>
<p dir="auto">The instructions for updating the Arduino IDE and the compilers can be found here: <a href="https://nicohood.wordpress.com/2015/01/24/installing-avr-gcc-4-8-1-and-arduino-ide-1-6-on-raspberry-pi/" rel="nofollow ugc">https://nicohood.wordpress.com/2015/01/24/installing-avr-gcc-4-8-1-and-arduino-ide-1-6-on-raspberry-pi/</a></p>
]]></description><link>https://forum.mysensors.org/post/10550</link><guid isPermaLink="true">https://forum.mysensors.org/post/10550</guid><dc:creator><![CDATA[Zerphed]]></dc:creator><pubDate>Mon, 23 Feb 2015 13:32:17 GMT</pubDate></item></channel></rss>