"X was not declared in this scope" errors with new custom library

I wrote a sketch that successfully interfaced between a keypad and Sparkfun's Serial Enabled 20x4 LCD screen. It's main functionality is to take input from the keypad, display it on the screen, and return it to the user when the enter key is pressed. This is a part of a larger project, so I decided to make it into a library to keep all my code organized. This is my first time writing a library. I wrote the entire library and created a test sketch to test its basic functionality. When I try to compile the sketch, I get a long line of "X was not declared in this scope" errors. Here is the actual readout:

/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp: In function 'void print(char*, int)':
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:220: error: 'moveCursorToPosition' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp: In function 'void clearDisplay()':
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:228: error: 'secondKeyActive' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp: In function 'int keypadCheck()':
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:281: error: 'keypadAddress' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:299: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:317: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:317: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:318: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:318: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:319: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:319: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:320: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:320: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:323: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:323: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:324: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:324: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:325: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:325: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:326: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:326: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:329: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:329: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:330: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:330: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:331: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:331: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:332: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:332: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:335: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:335: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:336: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:336: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:337: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:337: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:338: error: 'pinState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:338: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:345: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:345: error: 'buttonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:350: error: 'secondKeyActive' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:359: error: 'newButtonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:366: error: 'buttonState' was not declared in this scope
/Users/tjsmith/Documents/Program Data/Arduino/libraries/Keypad_LCD/Keypad_LCD.cpp:371: error: 'secondKeyActive' was not declared in this scope

Most of the variables that are not declared in the scope exist in earlier functions in my .cpp file and do not cause error messages, so I have no idea what's going on. Attached are my .h and .cpp files. I figured they were too big to include in the post. Thanks for any help!

Keypad_LCD.h (1.4 KB)

Keypad_LCD.cpp (14.6 KB)

Check bullet point three: http://arduino.land/FAQ/content/1/3/en/what-does-the-ide-change-in-my-sketch.html

Most of the variables that are not declared in the scope exist in earlier functions in my .cpp file and do not cause error messages, so I have no idea what's going on. Attached are my .h and .cpp files. I figured they were too big to include in the post. Thanks for any help!

Since you also needed to post your sketch, your grade for this post is a 67. That's failing.

I already read that article, and I don't think any of those things is my problem. The identifiers are all spelled correctly, I included the .h file at the beginning of the .cpp file, and all the identifiers are declared in the .h file. I don't think the identifiers are actually out of scope, because they work in other functions in the .cpp file, but I guess that something like that is probably the issue. I just don't see how.

I apologize for not including my sketch. It seemed that the problem was with the library and not the sketch, so I didn't include it, but here it is now:

#include <Wire.h>
#include <Keypad_LCD.h>

Keypad_LCD lcd;

const byte keypadAddress = B0100000;
const int keypadResetPin = 31;  //resest for the MCP (I/O expander)

void setup() {
  Wire.begin();
  Serial.begin(9600);
  lcd.begin(keypadAddress, keypadResetPin);
}

void loop() {
  Serial.print("Waiting for input... ");
  lcd.print("Enter barcode: ", 20);
  Serial.print(lcd.getKeypadInput(40, 49));
  Serial.println("!");
  lcd.clearDisplay();
}

Hi TJFS

Looking in your .cpp file, the error messages seem to start at the first method that is not prefixed with the class name:

void print(char* output)

Could you try:

void Keypad_LCD::print(char* output)

And the same for the remaining methods.

Regards

Ray

Yep, that fixed it! Thank you so much.