'Wire' does not name a type

Issue #51 closed
Pierre Montet
created an issue

I use a Sainasmart LCD 2004 I2C screen. I use the IDE 1.6.1 to 1.6.3 .

My compile return me :

C:\tmp\Arduino Compilateur\arduino-1.6.1\libraries\LiquidCrystal_V1.3\I2CIO.cpp:54:3: error: 'Wire' does not name a type
C:\tmp\Arduino Compilateur\arduino-1.6.1\libraries\LiquidCrystal_V1.3\I2CIO.cpp:55:3: error: 'error' does not name a type
   error = Wire.endTransmission();
C:\tmp\Arduino Compilateur\arduino-1.6.1\libraries\LiquidCrystal_V1.3\I2CIO.cpp:56:3: error: expected unqualified-id before 'if'
   if (error==0){
C:\tmp\Arduino Compilateur\arduino-1.6.1\libraries\LiquidCrystal_V1.3\I2CIO.cpp:59:3: error: expected unqualified-id before 'else'
   else //Some error occured
C:\tmp\Arduino Compilateur\arduino-1.6.1\libraries\LiquidCrystal_V1.3\I2CIO.cpp:63:1: error: expected declaration before '}' token

This error does not exist with the 1.2.1 version. It exist with the Download repository version (1.2.2 ???)

Thanks for your help !!!

Comments (8)

  1. Francisco Malpartida repo owner

    Comment from forum thread: I figured out the problem. It's not enough to put "#include <Wire.h>" in the source file you are using the library in. It seems you must also put "#include <Wire.h>" in the main *.ino file for the sketch as well, before it can be used in any other source code files.

    I will need to review the examples to see if it fixes the problem.

  2. srul76

    i had the same issue when i comment the below lines it start to works for me (in the I2CIO.h file) i didn't figured out what those lines do but i wanted to see somthing on my LCD and it is working now... :)

    BTW - i was needed to play with screw behind the LCD to reduce the contrast...

    // Wire.beginTransmission(DisplayI2CAddress); // error = Wire.endTransmission(); // if (error==0){ // return 1; // } // else //Some error occured // { // return 0; // } //}

  3. Log in to comment