Arduino build error

error: 'class HardwareSerial' has no member named 'printn'

The name after the dot is not a function or a field of that object. It is misspelled, it belongs to another class, or the library version has no such call.

  • Build error
  • 3 common causes
  • Seen 290 times in failed builds on Mokxi in the 30 days to November 16, 2026.
The message

What the Arduino IDE prints

Output window
sketch.ino: In function 'void setup()':
sketch.ino:4:10: error: 'class HardwareSerial' has no member named 'printn'
    4 |   Serial.printn("hello");
exit status 1

The class named in the message tells you which object you are calling it on.

Mokxi's compiler, clang, words it as no member named 'printn' in 'HardwareSerial', often with a did you mean.

Causes

The 3 usual causes with the fix

1The call is misspelled

Method names are case sensitive. Serial.printn and Serial.println are two different names.

Broken
void setup() {
  Serial.begin(9600);
  Serial.printn("hello");
}

void loop() {
}
Fixed
void setup() {
  Serial.begin(9600);
  Serial.println("hello");
}

void loop() {
}

Mokxi’s build tab says: HardwareSerial has nothing called printn.

Try this fix in Mokxi

2A struct field is misspelled

A field is found by its exact name. Check the declaration of the struct.

Broken
struct Point {
  int x;
  int y;
};

Point spot = {3, 4};

void setup() {
  Serial.begin(9600);
  Serial.println(spot.z);
}

void loop() {
}
Fixed
struct Point {
  int x;
  int y;
};

Point spot = {3, 4};

void setup() {
  Serial.begin(9600);
  Serial.println(spot.y);
}

void loop() {
}

Mokxi’s build tab says: Point has nothing called z.

Try this fix in Mokxi

3A call that this library does not have

Code written for another library or version calls something this one lacks. Open the library example for the calls it has.

Broken
#include <Servo.h>

Servo gate;

void setup() {
  Serial.begin(9600);
  gate.attach(9);
  gate.turn(90);
  Serial.println("turned");
}

void loop() {
}
Fixed
#include <Servo.h>

Servo gate;

void setup() {
  Serial.begin(9600);
  gate.attach(9);
  gate.write(90);
  Serial.println("turned");
}

void loop() {
}

Mokxi’s build tab says: Servo has nothing called turn.

Try this fix in Mokxi

FAQ

Questions and answers

What does "has no member named" mean?

The object has no function or field with that name. Check the spelling, the capital letters and the library.

What is a member?

A function or variable that belongs to a class or struct, reached with a dot, such as Serial.println.

Why does it fail only after I update a library?

Newer versions rename or remove calls. Look at the examples in the library for the current names.