[SOLVED] Libraries that i download wont compile .

sorry if this question has been posted before .
i download some custom LCD&keypad libraries
so i try to upload that , but arduino 1.0.5 say “error compiling”

would you share your experience to help me solve this problem ?

11/04/2014 THIS PROBLEM HAS BEEN SOLVED

pYro_65:

C:\Users\gissagiswara\Documents\Arduino\libraries\LCDKeypad\LCDKeypad.cpp:5:22: error: WProgram.h: No such file or directory

In LCDKeypad.cpp
Change the #include “WProgram.h” to #include “Arduino.h”

WProgram.h is from pre 1.0 versions, now Arduino.h is used.

thank you for all good people that tried to helping me to solve this problem
Excuse my bad English! :slight_smile:

Don’t post screen captures - there almost unreadable Use copy and paste ffor both the code and the error message. Code in code tags of course.

Mark

User downloaded libraries do NOT go in the core library folder. Learn to download and install them properly.

Did you restart the IDE after mangling the install?

holmes4:
Don’t post screen captures - there almost unreadable Use copy and paste ffor both the code and the error message. Code in code tags of course.

Mark

sorry , here the code that i want to upload to my uno

/*
DFRobot LCD Shield for Arduino
Key Grab v0.4
Written by Glendon Klassen
gjklassen@gmail.com
http://www.sourceforge.net/users/ecefixer
http://ecefixer.tumblr.com

Special Thanks to keithspg@users.sf.net for Cytron device support ARVs.

Displays the currently pressed key on the LCD screen.

Key Codes (in left-to-right order):

None   - 0
Select - 1
Left   - 2
Up     - 3
Down   - 4
Right  - 5

*/

#include <LiquidCrystal.h>
#include <DFR_Key.h>

//Pin assignments for DFRobot LCD Keypad Shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); 
//---------------------------------------------

const int DFRKEY = 0;
const int CYTRON = 1;

DFR_Key keypad(1);

int localKey = 0;
int prevNonWaitKey = 0;
int count = 0;
String keyString = "";
                 
void setup() 
{ 
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Key Counter v0.4");
  delay(1000);
  
  /*
  OPTIONAL
  keypad.setRate(x);
  Sets the sample rate at once every x milliseconds.
  Default: 10ms
  */
  keypad.setRate(10);

}

void loop() 
{ 
  /*
  keypad.getKey();
  Grabs the current key.
  Returns a non-zero integer corresponding to the pressed key,
  OR
  Returns 0 for no keys pressed,
  OR
  Returns -1 (sample wait) when no key is available to be sampled.
  */
  localKey = keypad.getKey();
  
  if (localKey != SAMPLE_WAIT)
  {
    if (localKey != prevNonWaitKey)
    {
      if (localKey == UP_KEY)
      {
        count++;
      }
      else if (localKey == DOWN_KEY)
      {
        count--;
      }
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Current Count:");
      lcd.setCursor(0, 1);
      lcd.print(count);
      prevNonWaitKey = localKey;
    }
  }
}

and this is the error message

C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp: In constructor 'DFR_Key::DFR_Key(int)':
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:29: error: 'def' was not declared in this scope
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:29: error: 'DFRKEY' was not declared in this scope
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp: At global scope:
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:84: error: no 'void DFR_Key::setARV(int, int)' member function declared in class 'DFR_Key'

PaulS:
User downloaded libraries do NOT go in the core library folder. Learn to download and install them properly.

Did you restart the IDE after mangling the install?

so where i can put the user download libraries ? YES i always restart my IDE after add downloaded libraries
before i got this problem , i’ve download LcdBarGraph libraries and put in the core library folder , and upload was success .
so i think i can download other libraries and try to learn the function of the code inside the libraries , but when i upload this libraries , it always said , i just want to know how my LCDkeypad Shield work and function

C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp: In constructor 'DFR_Key::DFR_Key(int)':
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:29: error: 'def' was not declared in this scope
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:29: error: 'DFRKEY' was not declared in this scope
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp: At global scope:
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:84: error: no 'void DFR_Key::setARV(int, int)' member function declared in class 'DFR_Key'

#include <DFR_Key.h> ← DFR_Key.h has been located right ?

SORRY FOR MY ENGLISH :smiley:

so where i can put the user download libraries ? YES i always restart my IDE after add downloaded libraries before i got this problem

3rd party and user written libraries should be loaded into a folder named library in the user's sketch directory, If one isn't there then you need to create this library folder. Then specific downloaded libraries are saved in a folder with the same name as the xxx.h file along with any other files used by the library.

If you do install 3rd party libraries into the arduino core section the problem is that if and when you ever upgrade to a newer version of the IDE you will lose all your 3rd party libraries unless you manual copy them before you upgrade the IDE and then manual re-install them into the IDE's core library folder. The user's sketch directory is not erased when one upgrades the IDE so all your 3rd party libraries are not disturbed.

retrolefty:

so where i can put the user download libraries ? YES i always restart my IDE after add downloaded libraries
before i got this problem

3rd party and user written libraries should be loaded into a folder named library in the user’s sketch directory, If one isn’t there then you need to create this library folder. Then specific downloaded libraries are saved in a folder with the same name as the xxx.h file along with any other files used by the library.

If you do install 3rd party libraries into the arduino core section the problem is that if and when you ever upgrade to a newer version of the IDE you will lose all your 3rd party libraries unless you manual copy them before you upgrade the IDE and then manual re-install them into the IDE’s core library folder. The user’s sketch directory is not erased when one upgrades the IDE so all your 3rd party libraries are not disturbed.

this is how I i try the importing via IDE . not manually copy and paste to directory :

1st. i reinstall my IDE
2nd.I open my IDE , sketch → Import Library → automatically my downloaded libraries located in my document/Arduino/libraries right ?
i check the file name before i upload the sketch
folder name DFR_Key

the name of .h & .cpp file , same with the folder name “DFR_Key”
but when i tried to upload the sketch

C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp: In constructor 'DFR_Key::DFR_Key(int)':
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:29: error: 'def' was not declared in this scope
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:29: error: 'DFRKEY' was not declared in this scope
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp: At global scope:
C:\Users\gissagiswara\Documents\Arduino\libraries\DFR_Key\DFR_Key.cpp:84: error: no 'void DFR_Key::setARV(int, int)' member function declared in class 'DFR_Key'

that error message always shown

Thank you for all your help

You are the only one that knows where you got the library. Unless you tell us, you are going ot have to fix it yourself.

Does DFR_key include any other libraries, either built-in or installed yourself?

pYro_65: Does DFR_key include any other libraries, either built-in or installed yourself?

i check my core libraries directory and also in my document/arduino/libraries there is nothing a libraries that named " DFR_key "

i've tried to re installing DFR_key libraries using this guide http://arduino.cc/en/Guide/Libraries

but the error message won't gone

i've tried to installing the other libraries , that i've download from http://dimme.net/wp-content/uploads/LCDKeypad.rar

using same way that has been pointed here "http://arduino.cc/en/Guide/Libraries"

but when i tried to upload the sketch this error messages apear

C:\Users\gissagiswara\Documents\Arduino\libraries\LCDKeypad\LCDKeypad.cpp:5:22: error: WProgram.h: No such file or directory
C:\Users\gissagiswara\Documents\Arduino\libraries\LCDKeypad\LCDKeypad.cpp: In member function 'int LCDKeypad::button()':
C:\Users\gissagiswara\Documents\Arduino\libraries\LCDKeypad\LCDKeypad.cpp:22: error: 'analogRead' was not declared in this scope

I really very sorry because many questions that i ask . i confused , i've read the instruction how to add the custom libraries and follow the instructions but still cant completed i've try to install the latest of IDE version

C:\Users\gissagiswara\Documents\Arduino\libraries\LCDKeypad\LCDKeypad.cpp:5:22: error: WProgram.h: No such file or directory

In LCDKeypad.cpp Change the #include "WProgram.h" to #include "Arduino.h"

WProgram.h is from pre 1.0 versions, now Arduino.h is used.

pYro_65:

C:\Users\gissagiswara\Documents\Arduino\libraries\LCDKeypad\LCDKeypad.cpp:5:22: error: WProgram.h: No such file or directory

In LCDKeypad.cpp
Change the #include “WProgram.h” to #include “Arduino.h”

WProgram.h is from pre 1.0 versions, now Arduino.h is used.

wow , its work , now i can upload my sketch & there is no error message anymore .
Thank you very much , I really appreciate it
you just made my day .
hope i can be great like you all . someday

Haha, no problem.

A while ago this was a very common error.