Error with serial.printf function

Could anybody tell me why I am getting an error message with serial.prinf function. My code used to work fine until I reinstalled arduino.

#include <SoftwareSerial.h>
#define txPin 45

SoftwareSerial LCD = SoftwareSerial(0, txPin);

void setup()
  pinMode(txPin, OUTPUT);

void loop()
  int SW = 1;
  LCD.printf("Switch failed %d", SW);

There is more code to it but this is the main part for this print function.

I am getting an error:“class SoftwareSerial” has no member named printf"

I tried println but I get another error call of overloaded println.

Could anyone help me on this please.

SoftwareSerial doesn't have a printf. Use sprintf to format your string into a char array and then print that array.

Why are you doing SoftwareSerial on a Mega?

I am using Teensy 2++ board and LCD display


  LCD.println("Switch failed %d", SW);

is no good. Use

  LCD.print("Switch failed ");

is no good. Use

LCD.println()? How is the LCD supposed to roll the carriage?

Hmm... compiles fine using Arduino 1.6.8 & Teensyduino 1.28 & Teensy++ 2.0.

Did you reinstall Teensyduino after reinstalling Arduino?
Do you have the right board selected?