Library Tutorial doesn't seem to work

I followed the library tutorial shown at http://arduino.cc/en/Hacking/LibraryTutorial and when verifying the sketch, the following error message appears:

sketch_sep19b:2: error: 'Morse' does not name a type
sketch_sep19b.cpp: In function 'void loop()':
sketch_sep19b:10: error: 'morse' was not declared in this scope

I'm using Arduino 1.0.1, and have manually created all of the files & directory as well as downloaded the zip file at the end of the tutorial. In both cases, the same error message results.

So, either I'm doing something in error, or the 5 year old tutorial needs to be updated.

Any and all help would be appreciated.

Post the code that's generating those error message, and I'm sure you'll get all the hope you need. Without the code, any help provided will just be shots in the dark.

Here's the sketch copied from the web page:

#include <Morse.h>

Morse morse(13);

void setup()
{
}

void loop()
{
  morse.dot(); morse.dot(); morse.dot();
  morse.dash(); morse.dash(); morse.dash();
  morse.dot(); morse.dot(); morse.dot();
  delay(3000);
}

And here's the header file (Morse.h) from the website:

/*
  Morse.h - Library for flashing Morse code.
  Created by David A. Mellis, November 2, 2007.
  Released into the public domain.
*/
#ifndef Morse_h
#define Morse_h

#include "Arduino.h"

class Morse
{
  public:
    Morse(int pin);
    void dot();
    void dash();
  private:
    int _pin;
};

#endif

And finally, here's the C++ file, also from the website:

/*
  Morse.cpp - Library for flashing Morse code.
  Created by David A. Mellis, November 2, 2007.
  Released into the public domain.
*/

#include "Arduino.h"
#include "Morse.h"

Morse::Morse(int pin)
{
  pinMode(pin, OUTPUT);
  _pin = pin;
}

void Morse::dot()
{
  digitalWrite(_pin, HIGH);
  delay(250);
  digitalWrite(_pin, LOW);
  delay(250);  
}

void Morse::dash()
{
  digitalWrite(_pin, HIGH);
  delay(1000);
  digitalWrite(_pin, LOW);
  delay(250);
}

The code that's on the website and that on the ZIP download http://arduino.cc/en/uploads/Hacking/Morse.zip appear to be identical.

I'm using Arduino 1.0.1

Dump 1.0.1, and go back to 1.0.0. 1.0.1 has a fatal flaw, where missing include files are no longer fatal errors.

You have a library installed in the wrong place, so the IDE can't find it.

Where did you put Morse.h and Morse.cpp?

I reverted back to Arduino 1.0 and the sketch compiles. NB, I did have to edit the header file contained in the ZIP file - Wprogram.h to Arduino.h. It would be nice to get the tutorials current with the latest release.

The files are in the arduino-1.0.1\libraries\Morse directory. I'm using Windows 7.

Thanks.

bpospick:
The files are in the arduino-1.0.1\libraries\Morse directory.

That's at least part of your problem. Third-party libraries are to be installed in the libraries subdirectory of your sketchbook folder (My Documents\Arduino\ or something similar under Windows, I believe), not in the Arduino program folder. See Libraries - Arduino Reference under the heading "Contributed Libraries" for more information.