Undefined reference to `Servo::attached()'

I am using UNO R4 v 1.0.1. When I compile the following simple program:

#include <Servo.h>

Servo myservo;  // create servo object to control a servo



void setup() {
  myservo.attach(5);  // attaches the servo on pin 9 to the servo object
  if(myservo.attached()){
    Serial.println("Attached");
  }
  else{
    Serial.println("Not attached");
  }
}

void loop(){
  delay(1000);
}

I get the following compilation error:

WARNING: library Servo claims to run on avr, megaavr, sam, samd, nrf52, stm32f4, mbed, mbed_nano, mbed_portenta, mbed_rp2040, renesas architecture(s) and may be incompatible with your current board which runs on renesas_uno architecture(s).
/tmp/arduino/sketches/36FAC291AF60C805999F6ED9B4200DEA/sketch/sketch_jun27a.ino.cpp.o: In function `setup':
/tmp/.arduinoIDE-unsaved2023527-98555-zhjyf2.s3jvf/sketch_jun27a/sketch_jun27a.ino:9: undefined reference to `Servo::attached()'
collect2: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

This also occurs on the Uno R4 Minima

This does not occur on an Uno R3.

See Arduino® UNO R4 Minima — Arduino Official Store

In particular

Are all libraries compatible with the UNO R3 also compatible with the UNO R4 Minima?

No, some UNO R3 libraries use instructions of the AVR architecture that are not compatible with the architecture of the UNO R4 Minima, however there are libraries that have already been ported as part of our early adopters program or are based on the Arduino API.

I downloaded and installed the latest files from GitHub. The attached() method is included in those files. The release has not been bumped up to reflect this change.

We just pushed a new release for the Servo library which includes this fix! Version is 1.2.1. Thank you for reporting this :slight_smile: