Problem updating old KittyTwitty sketch

I’m trying to update the old MAKEzine KittyTwitty sketch to use the included String instead of the older TextString library originally specified. I’m also incidentally adapting it to use in a lab with naked mole-rats. I think it should work but I keep hitting the same error and after two days I’m still stumped. The error:

KittyTwittyFifthTime.ino: In function ‘void tweet()’:
KittyTwittyFifthTime:125: error: no matching function for call to ‘Twitter::post(String&)’
C:\Users\Michael\Documents\Arduino\libraries\Twitter/Twitter.h:40: note: candidates are: bool Twitter::post(const char*)

and the code:

/*MoleRat Twitty

 Kittty Twitty Cat Toy v1.0 renamed and only slightly edited for Naked Mole Rats by me
 by Marc de Vinck
 Jan 6, 2010
 
 For KittyTwitty cat toy project found in MAKE, Volume 22
 
 This project continues to evolve online at: wwwmakezine.com/kittytwitty
 
 Twitter Library for Arduino V1.0.1 created by NeoCat
 http://www.arduino.cc/playground/Code/TwitterLibrary
 
 String (formerly TextString) Library by Tom Igoe
 http://www.arduino.cc/en/Tutorial/TextString
 
 */
//Me here: Looks like some of the code is obsolescent. String library has been replaced, also I need to get IP info which will be hairy.
//these are libraries that need to be included for the program to work, see links above
#include <SPI.h>
#include <Ethernet.h>    // this allows us to use the Ethernet shield easily
#include <Twitter.h>     // this allows us to easily talk to Twitter
#include <String.h>     // this allows us to easily chain a string of words together

// these constants will not change

const int powerPin = 9;  //  power LED pin
const int statusPin = 8;  //  status LED pin
const int wirePin = 6;  //  the pin that the guitar wire is connected to

// These are variables that will change

int var;  // used to store the status of pin (6)

long randNum1;  // variable that will store random number 1
long randNum2;  // variable that will store random number 2
long randNum3;  // variable that will store random number 3

// define a a new string of data

String dataString;

// defining the network setting for the Ethernet Shield

byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // this can be made up
byte ip[] = { 
  192, 168, 2, 7 }; // a free IP address on your network
byte gateway[] = { 
  192, 168, 2, 1 }; // the gateway address of your network
byte subnet[] = { 
  255, 255, 255, 0 };  // the subnet mask of your network

Twitter twitter("user:password");  // defines your username:followed by your password

char* words1[] = {
  "Chester ","The cat ", "Your little buddy ", "Monster cat ", "Bad cat ", "Furball "};       // array of words for the first section of the sentence
char* words2[] = {
  "loves", "pwned", "destroyed", "pownced on", "attacked", "stalked"};       // array of words for the second section of the sentence
char* words3[] = {
  "Meow!", "Prrrrrr", ">^,,^<", "Yowzers!", "Squeak!" };       // array of words for the final section of the sentence

void setup(){    // run this code once

  pinMode(wirePin, INPUT);        //defining the wire pin as an input so we can read it
  pinMode(powerPin, OUTPUT);      // sets the pin as output
  pinMode(statusPin, OUTPUT);      // sets the pin as output

  digitalWrite(powerPin, HIGH);   // sets the power LED (green one) on


  Serial.begin(9600);              // starts serial communications so we can debug easier

  Ethernet.begin(mac, ip, gateway, subnet);  //begins the Ethernet connection from the stored information
  delay(2000);        // a 1 second delay to let everything settle down!

  // let's tweet that we are up and running

  Serial.println("MoleRat Twitty is up and running!");  // print, used for debugging
  Serial.println();                                    // print a blank line, used for debugging
  Serial.println("Connecting to Twitter...");          // print, used for debugging

  digitalWrite(statusPin, HIGH);   // sets the status LED off

  if (twitter.post("MoleRat Twitty is up and running!")) {  // Twitter that we are up and running
    int status = twitter.wait();     // wait for a response from twitter                    
    if (status == 200) {    // if Twitter responds 200
      Serial.println("Tweet OK!");  // print success
      Serial.println();  // print a blank line, used for debugging
    } 
    else {
      Serial.print("Tweet failed : code ");
      Serial.println(status);  // print error code
      Serial.println();  // print a blank line, used for debugging
    }
  } 
  else {
    Serial.println("Connection to Twitter failed.");
  }
  delay (1000); // delay 1 second
  digitalWrite(statusPin, LOW);   // sets the status LED off
  Serial.println("Waiting for someone to play with me!"); // print, used for debugging
}

void loop(){ // run over and over, never stop

    checkState();  // check status of wire sensor
}


void tweet(){  // function tweet, this is called if status = 1

  randNum1 = random(6);  //generate a random number from 0-6
  randNum2 = random(6);  //generate a random number from 0-6
  randNum3 = random(5);  //generate a random number from 0-5

    String sentence = words1[randNum1];  // datastring is a word from the array word1, selects based on random number generated
  sentence +=(words2[randNum2]);  // add to the datastring a word from the array word2, selects based on random number generated
  sentence +=(" MoleRat Twitty! ");  // add to the datastring  "MoleRat Twitty!"
  sentence +=(words3[randNum3]); // add to the datastring a word from the array word1, selects based on random number generated


  Serial.println("Connecting to Twitter...");  // print, used for debugging
  Serial.println();     // print a blank line, used for debugging
  if (twitter.post(sentence)) {  // tweet the completed datastring of words
    Serial.print("Tweeting -- ");  // print, used for debugging
    Serial.print(dataString);  // print, used for debugging
    Serial.print(" -- Status: ");  // print, used for debugging
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("Successful!");
      Serial.println();
    } 
    else {
      Serial.print("Tweet failed : code "); // print error code
      Serial.println(status);  // print error code
    }
  } 
  else {
    Serial.println("Connection to Twitter failed."); // print error code
  }
  Serial.println("30 Second timeout started."); // print, used for debugging
  Serial.println();  // print a blank line, used for debugging
  delay (30000);  // this delay of 30 seconds after a tweet ensures we don't over-tweet (150/per hour)
  digitalWrite(statusPin, LOW);   // sets the status LED off
  Serial.println("Waiting for someone to play with me!"); // print, used for debugging
  Serial.println();      // print a blank line, used for debugging

}

void checkState(){    // check status of wire function

  var = digitalRead(wirePin);  // read the status of the wire pin

    if (var==1){      // if the pin is HIGH (+ 5v)
    digitalWrite(statusPin, HIGH);   // turn on the status LED
    tweet();            // go to the Tweet function to send out a tweet
    delay (2000);  // wait for 2 seconds
    digitalWrite(statusPin, LOW);   // turn off the status LED
  }
  else{
    digitalWrite(statusPin, LOW); // turn off the status LED
  }
}

It doesn’t upload to the Arduino. So I tried the example code that comes with the Twitter library and it works, but I can’t find the difference between the example and my sketch. The SimplePost example is below:

#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>


// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("YOUR-TOKEN-HERE");

// Message to post
char msg[] = "Hello, World! I'm Arduino!";

void setup()
{
  delay(1000);
  Ethernet.begin(mac, ip);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
}

void loop()
{
}

I think it has something to do with how I’m concatenating the string, or else with how I’m passing the string to the Twitter part. But I can’t crack it. Could someone point me in the right direction? Did I miss a parentheses or something basic, or am I using the string function wrong?

In the code that works the argument used in Twitter.post() is a string.
In the code that does not work the argument used in Twitter.post() is a String.

Spot the difference ?

Switch to using strings instead of Strings and the problem will go away.