Go Down

Topic: compiling errors <LCD4Bit.h>|<LCD4Bit_mod.h> (Read 5 times) previous topic - next topic

keyz01

Dec 19, 2011, 04:13 am Last Edit: Dec 19, 2011, 04:19 am by keyz01 Reason: 1
Hello,

OS:Windows 7
board:arduino Uno
IDE:arduino-1.0
shield:KeyPadLCDShield

I get errors when compiling the sketch with the #include <LCD4Bit.h> old LCD library, this shield (KeyPadLCDShield from muelectronic) requires this library or the <LCD4Bit_mod.h> in order to work.
sketch>import library>LCD4Bit adds <LCD4Bit.h> in the IDE text editor.
The program never compiles, even with the first one nor the second one, the compiler sends me error messages.

arduino-1.0-windows\arduino-1.0\libraries\LCD4Bit\LCD4Bit.cpp:29:57: error: WConstants.h: No such file or directory
.........
arduino-1.0-windows\arduino-1.0\libraries\LCD4Bit\LCD4Bit.cpp:225: error: 'delay' was not declared in this scope

tested with
#include <LiquidCrystal.h>
void setup(){};  
void loop(){};
compiles successfully!

jczorglub

OS:Windows XP
board:arduino Uno
IDE:arduino-1.0
shield:KeyPadLCDShield

Hello!
Also newbie, I have the same problem.
I googled a bit, but did not find anything useful.
Could you solve this issue?
Thanks for helping a more newbie than you!

SurferTim

Open this file.
arduino-1.0-windows\arduino-1.0\libraries\LCD4Bit\LCD4Bit.cpp
At line 29, you should find this
#include <WConstants.h>
Change to
#include <Arduino.h>
The delay declaration in now in that file in V1.0.


pbendel

I have no luck as well.

I have Win7, Arduino IDE 1.0, Duemanilove

I changed line 29 in the CPP file as above to from WContstants.h to Arduino.h

It still has a whole pile of compiler errors.

Anything else I am missing?

raechten

Just received my LCD shield and had the same problem. Looking at some other libraries that are (made) v1.0 compatible, I figured out that for it to work with v1.0 arduino code, you don't need all the other libraries, just Arduino.h and the LCD4Bit_mod.h. I changed the headers in the LCD4Bit_mod.cpp file to look like this:

#include "LCD4Bit_mod.h"
#if (ARDUINO < 100)
  extern "C" {
    #include <stdio.h>  //not needed yet
    #include <string.h> //needed for strlen()
    #include <inttypes.h>
    #include "WProgram.h"
  }
#else
  #include <Arduino.h>
#endif

It now works for v1.0 and it SHOULD still work for older Arduino versions (although I have not tested that).

Hope it helps,

Robert :-)

avbeek

Thanks Robert, that worked for me on my Uno rev3!

cheers,

Arthur

yimiblu

Hello all!
I'm absolutely new here, and new on using arduino 'by myself'. I've read all what i found here about "Cannot find WConstants.h", and still cant find the problem. I'm trying to use one of the stepper motor control provided with the last version of arduino software, reporting:

In file included from stepper_speedControl.ino:20:
/Users/xxx/Documents/Arduino/libraries/Stepper/Stepper.h:52:24: error: WConstants.h: No such file or directory

but there is no reference to that "WConstants.h" file neither on that stepper.h, or .cpp or everywhere in my arduino instalation :/

I know you'll hate me, and maybe you'll ban me, but... i cant understand (yet..) :(

Thanks a lot.

Javi


keyz01

#7
Sep 25, 2013, 11:15 pm Last Edit: Sep 25, 2013, 11:30 pm by keyz01 Reason: 1
I solved the problem by downgrading from version 1.0 to 0023.
See that post http://forum.arduino.cc/index.php/topic,96356.0.html
LCD4Bit_mod is not compatible with versions > arduino 0.23.
And also notice it have to be use with HD44780 LCD driver.

crasherman

thank you Robert !

It's working for me too :) with arduino 1.0.5-r2

favwiz

Thanks.  This fix worked for the code that comes with the SainSmart LCD Keypad Shield. 

Go Up