how to fix this upload error?

all the files are in same folder but fails to upload i get error!

#include <Keypad.h>
#include <Password.h>

// include <Password.h> // http://www.arduino.cc/playground/uploads/Code/Password.zip
// include <Keypad.h> // http://www.arduino.cc/playground/uploads/Code/Keypad.zip



//* is to validate password   
//# is to reset password attempt

/////////////////////////////////////////////////////////////////


Password password = Password( "1234" );

const byte ROWS = 4; // Four rows
const byte COLS = 4; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {
    '1','2','3','A'  }
  ,
  {
    '4','5','6','B'  }
  ,
  {
    '7','8','9','C'  }
  ,
  {
    '*','0','#','D'  }
};

byte rowPins[ROWS] = { 
  9,8,7,6 };// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 
  5,4,3,2, };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){

  Serial.begin(9600);
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad
}

void loop(){
  keypad.getKey();
}

//take care of some special events
void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
  case PRESSED:
    Serial.print("Pressed: ");
    Serial.println(eKey);
    switch (eKey){
    case '*': 
      checkPassword(); 
      break;
    case '#': 
      password.reset(); 
      break;
    default: 
      password.append(eKey);
    }
  }
}

void checkPassword(){
  if (password.evaluate()){
   // Serial.println("Success");
    Serial.println("Correct");
    // do unlock here

    //Add code to run if it works
  }
  else{
    Serial.println("Wrong");
    //add code to run if it did not work
  }
}

DoorPassCheck_2014.ino:16:18: error: variable or field ‘keypadEvent’ declared void
DoorPassCheck_2014.ino:16:18: error: ‘KeypadEvent’ was not declared in this scope
DoorPassCheck_2014.ino:13:1: error: ‘include’ does not name a type
DoorPassCheck_2014.ino:42:1: error: ‘Keypad’ does not name a type
DoorPassCheck_2014.ino: In function ‘void setup()’:
DoorPassCheck_2014.ino:47:3: error: ‘keypad’ was not declared in this scope
DoorPassCheck_2014.ino:47:27: error: ‘keypadEvent’ was not declared in this scope
DoorPassCheck_2014.ino: In function ‘void loop()’:
DoorPassCheck_2014.ino:51:3: error: ‘keypad’ was not declared in this scope
DoorPassCheck_2014.ino: At global scope:
DoorPassCheck_2014.ino:55:18: error: variable or field ‘keypadEvent’ declared void
DoorPassCheck_2014.ino:55:18: error: ‘KeypadEvent’ was not declared in this scope

when i take out the# include lines

and this error when i leave the # in place

Password.cpp:113: first defined here
collect2: error: ld returned 1 exit status

the password.cpp file is as follows (whats wrong with it)?

/*
||
|| @file Password.cpp
|| @version 1.2
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
||  4/5/2012 Updates Nathan Sobieck: Nathan@Sobisource.com
||   Now v1.2 Arduino IDE v1.0 With BAckwards compatibility
||
|| @description
|| | Handle passwords easily
|| #
||
|| @license
|| | This library is free software; you can redistribute it and/or
|| | modify it under the terms of the GNU Lesser General Public
|| | License as published by the Free Software Foundation; version
|| | 2.1 of the License.
|| |
|| | This library is distributed in the hope that it will be useful,
|| | but WITHOUT ANY WARRANTY; without even the implied warranty of
|| | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
|| | Lesser General Public License for more details.
|| |
|| | You should have received a copy of the GNU Lesser General Public
|| | License along with this library; if not, write to the Free Software
|| | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
|| #
||
*/

#include "Password.h"

//construct object in memory, set all variables
Password::Password(char* pass){
	set( pass );
	reset();
}

//set the password
void Password::set(char* pass){
	target = pass;
}

//evaluate a string, is it equal to the password?
bool Password::is(char* pass){ 
	byte i=0;
	while (*pass && i<MAX_PASSWORD_LENGTH){
		guess[i] = pass[i];
		i++;
	}
	return evaluate();
}

//append a char to the guessed password
bool Password::append(char character){ 
	if (currentIndex+1==MAX_PASSWORD_LENGTH){
		return false;
	}else{
		guess[currentIndex++] = character;
		guess[currentIndex] = STRING_TERMINATOR; //ensure a valid c string
	}
	return true;
}

//reset the guessed password, one can guess again
void Password::reset(){ 
	currentIndex = 0;
	guess[currentIndex] = STRING_TERMINATOR;
}

//is the current guessed password equal to the target password?
bool Password::evaluate(){ 
	char pass = target[0];
	char guessed = guess[0];
	for (byte i=1; i<MAX_PASSWORD_LENGTH; i++){
		
		//check if guessed char is equal to the password char
		if (pass==STRING_TERMINATOR && guessed==STRING_TERMINATOR){
			return true; //both strings ended and all previous characters are equal 
		}else if (pass!=guessed || pass==STRING_TERMINATOR || guessed==STRING_TERMINATOR){
			return false; //difference OR end of string has been reached
		}
		
		//read next char
		pass = target[i];
		guessed = guess[i];
	}
	return false; //a 'true' condition has not been met
}

//set password using operator =
Password &Password::operator=(char* pass){
	set( pass );
	return *this;
}

//test password using ==
bool Password::operator==(char* pass){
	return is( pass );
}

//test password using !=
bool Password::operator!=(char* pass){
	return !is( pass );
}

//append to currently guessed password using operator <<
Password &Password::operator<<(char character){
	append( character );
	return *this;
}

/*
|| @changelog
|| | 2009-06-17 - Alexander Brevig : Added assignment operator =, equality operators == != and insertion operator <<
|| | 2009-06-17 - Alexander Brevig : Initial Release
|| #
*/

Perhaps the library is not installed. I would double check

i imported it and if thats the case why wouldnt it say it hasnt been imported ? any other ideas?

multimedia:
i imported it and if thats the case why wouldnt it say it hasnt been imported ? any other ideas?

With the libraries installed in the proper place, there is only one error message:

Binary sketch size: 4,438 bytes (of a 30,720 byte maximum)

So, you did NOT install them correctly.

I went to menu>sketch>import library and seleted all the required libraries, they were added and i saved and upload and got error! so what av i done wrong? please explain?

multimedia:
... if thats the case why wouldnt it say it hasnt been imported?

The compiler is not that smart. Actually it would give the same errors as you have now:

DoorPassCheck_2014.ino:47:3: error: ‘keypad’ was not declared in this scope
DoorPassCheck_2014.ino:47:27: error: ‘keypadEvent’ was not declared in this scope

which means the variables aren't initialized. Either its something wrong with the sketch (missing brackets, for example) or the code looks for this variable on a non existing .cpp file

Sometimes the library folder might not be correctly renamed.

the error is /libraries/Password/Password.cpp:113: first defined here
collect2: error: ld returned 1 exit status
so it can see the files else it wouldnt know where the files were! so i have no clue how to fix this :confused:

multimedia:
the error is /libraries/Password/Password.cpp:113: first defined here
collect2: error: ld returned 1 exit status
so it can see the files else it wouldnt know where the files were! so i have no clue how to fix this :confused:

casemod:
The compiler is not that smart. Actually it would give the same errors as you have now:

DoorPassCheck_2014.ino:47:3: error: ‘keypad’ was not declared in this scope
DoorPassCheck_2014.ino:47:27: error: ‘keypadEvent’ was not declared in this scope

which means the variables aren't initialized. Either its something wrong with the sketch (missing brackets, for example) or the code looks for this variable on a non existing .cpp file

Translating:

When you remove the #include lines it does not find the library and gives errors as above. That is the compiler way of giving you an error.

Anything else are issues with your code and / or IDE version.
If you are copying the code and given that it was released in 2009 I would try to compile using IDE 0022.

IM USING LINUX SO I CANT CHOOSE WHAT IDE I USE I USE SUDO APT-GET command and get what im given therefore the code needs to be changed and i do not know what to change to nake this work! please help!

multimedia:
IM USING LINUX SO I CANT CHOOSE WHAT IDE I USE I USE SUDO APT-GET command and get what im given therefore the code needs to be changed and i do not know what to change to nake this work! please help!

You do know that caps means SHOUTING right!?

I use Kubuntu and I have all versions.

Download the zip file and extract to a folder of your choice. Home area is good. Create individual folders for each version, for example 1.05, 1.5.6, etc, etc. Do not run the self extracting packages

i tryed that it failed so thats why i had to use sudo apt-get i also tried it again after you said to extract it i have file called arduino which i ran and it just brung up the latest version hence why i need to re write the actual code! i dont know why old ways of doing it stops working on newer ide it makes no sense! im started to hate ide raspberry pi just works why cant arduinos!

multimedia:
i tryed that it failed so thats why i had to use sudo apt-get i also tried it again after you said to extract it i have file called arduino which i ran and it just brung up the latest version hence why i need to re write the actual code! i dont know why old ways of doing it stops working on newer ide it makes no sense! im started to hate ide raspberry pi just works why cant arduinos!

Get used to changes. After trying the DUE and the mega I decided to get a real 2650 breakout board and program most stuff in AVR C.
Arduino is great for beginners but you'll quickly realize how much stuff you are missing from the actual capabilities on the chip, and most importantly how one's ignorance grows because of the abstraction layer. Oh, and because they decide to leave pins unconnected on the actual chip and therefore you cant use all features!

Now to your other issue... You tried and it failed.

The file is a zipped folder, so i don't see much to fail there, assuming you have an extraction program installed.
Extract it and run the arduino file inside. You also need Java, but I assume you have it correctly installed already.

arduino-0022.tgz (3.54 MB)

The file in the unzipped folder called arduino fails to open i want to use the version sudo apt made as all others fail to be usefull on mint i want to just update the code then it should work

Last resource you could try and run windows version trough wine. Failed to achieve this then I am afraid is more of an issue with the computer itself and out of the scope a programming question.

I suggest you open a post explaining the issue in the Installation & Troubleshooting section of the forum, hopefully you will get some answers there.

i have the latest installed which is what i said i want to use! i need the code edited to work in the newest ide therefore its not a setup problem as i can see my usb device perfectly fine! i dont know what to change in the code so its a programming issue! im sure someone knows how to do it or what to change or whats the point in this forum section at all! i have also explained no other ide will work on linux only the one provided by sudo apt-get install arduino and that is what i intend to use as that way i can update it from the command line, this is important for keeping my software up to date!

i dont wish to know about any other version as i have tried many different types and they all fail to load so unzipping files dont get me anywhere when the file inside called arduino (black icon) is pointless i open that with terminal it only loads the newest arduino so again its the code i need to work on not the ide as mine is fine!

version 1.1.0.5

dfsg 2-2

anyone who can code with this help me please!

anyone who can code with this help me please!

Since the code that you posted compiles and links correctly when the libraries are installed correctly, I can't imagine how a code change is going to help find incorrectly installed libraries.

well im totally new to this arduino im used to ftp and putting files where i want / need them i have added all required librarys without error and get error when i try and upload so how can i get this working step by step might help! i have made a new folder and put the librarys in there and tryed other ways and it still fails!

Sammy Davis, Jr. would be impressed by your tap dancing.

Now, cut the crap, sit down, and explain WHERE you put WHICH files.

iv tryed in my sketch folder inside my home folder and also in other folders i have tried on there own or all together it dosnt matter where i put them it always fails and i dont know why! and the library files ofc as the code goes inside the ide so obviously i mean the password and keypad files!

iv tryed in my sketch folder inside my home folder

You've tried doing what?

On my Windows system, Keypad.h is in C:\Users<my user id>\Documents\Arduino\libraries\Keypad.

Now, your turn. EXACTLY where is Keypad.h. No mumbo jumbo about relative paths. EXACT names!