IDE bpreprocessor errro[SOLVED]

I started a new project and I keep getting the same error again&again

`// DEBUG MODE
// Verbose reporting to Serial Monitor
#define DEBUG_ON
// LCD in system available
//#define LCD1602
#define LCD2004

#if defined LCD2004
byte lcdDisplayAddress = 0x27;
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(lcdDisplayAddress, 20, 4);  // set the LCD address to 0x27 for a 20 chars and 4 line display
#endif

#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
//this will compile for Arduino UNO, Pro and older boards
int _sck = 13;
int _miso = 12;
int _mosi = 11;
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//this will compile for Arduino Mega
int _sck = 52;
int _miso = 50;
int _mosi = 51;
#endif

#if defined(ARDUINO) && ARDUINO >= 100     // Arduino v1.0 and newer
#define I2C_WRITE Wire.write
#define I2C_READ Wire.read
#else                                      // Arduino Prior to v1.0 
#define I2C_WRITE Wire.send
#define I2C_READ Wire.receive
#endif

void setup() {
  Serial.begin(9600);
  while (!Serial) {};  // Leonardo: wait for Serial Monitor
  Serial.println("\nXtrack Receiver");
#if defined LCD2004
  wire.begin();
  lcd.init();  // initialize the lcd
  lcd.backlight();
#endif
}`

The wire lib doesnt start

I moved your topic to an appropriate forum category @kunstmaan.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Hi @kunstmaan.

It will not be possible for us to help you with that problem based on such a vague description. Please add a forum reply here that provides a detailed explanation of what you mean by this, including:

  • What did you do?
  • What were the results you expected from doing that thing?
  • What were the results you observed that did not match your expectations?

Make sure to include the full and exact text of any error or warning messages you might have encountered.

After compiling this error was shown:
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

loading library from c:\Users\Harry A\Documents\Arduino\libraries\Arduino_STM32-master: invalid library: no header files found
loading library from c:\Users\Harry A\Documents\Arduino\libraries\TFT: invalid library: no header files found
loading library from c:\Users\Harry A\Documents\Arduino\libraries\grbl-master: invalid library: no header files found
Detecting libraries used...
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard C:\Users\Harry A\AppData\Local\Temp\arduino\sketches\2F99F340C35371147222AF61B763B75D\sketch\sketch_jan1a.ino.cpp -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src C:\Users\Harry A\AppData\Local\Temp\arduino\sketches\2F99F340C35371147222AF61B763B75D\sketch\sketch_jan1a.ino.cpp -o nul
Alternatives for LiquidCrystal_I2C.h: [NewliquidCrystal LiquidCrystal I2C@1.1.2]
ResolveLibrary(LiquidCrystal_I2C.h)
-> candidates: [NewliquidCrystal LiquidCrystal I2C@1.1.2]
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C C:\Users\Harry A\AppData\Local\Temp\arduino\sketches\2F99F340C35371147222AF61B763B75D\sketch\sketch_jan1a.ino.cpp -o nul
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\Wire.cpp -o nul
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility\twi.c -o nul
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C c:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp -o nul
Generating function prototypes...
C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C C:\Users\Harry A\AppData\Local\Temp\arduino\sketches\2F99F340C35371147222AF61B763B75D\sketch\sketch_jan1a.ino.cpp -o C:\Users\Harry A\AppData\Local\Temp\4053405904\sketch_merged.cpp
C:\Users\Harry A\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\Harry A\AppData\Local\Temp\4053405904\sketch_merged.cpp
Compiling sketch...
"C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino" "-IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard" "-IC:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src" "-Ic:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C" "C:\Users\Harry A\AppData\Local\Temp\arduino\sketches\2F99F340C35371147222AF61B763B75D\sketch\sketch_jan1a.ino.cpp" -o "C:\Users\Harry A\AppData\Local\Temp\arduino\sketches\2F99F340C35371147222AF61B763B75D\sketch\sketch_jan1a.ino.cpp.o"
C:\Users\Harry A\Documents\Arduino\sketch_jan1a\sketch_jan1a.ino: In function 'void setup()':
C:\Users\Harry A\Documents\Arduino\sketch_jan1a\sketch_jan1a.ino:41:3: error: 'wire' was not declared in this scope
wire.begin();
^~~~
C:\Users\Harry A\Documents\Arduino\sketch_jan1a\sketch_jan1a.ino:41:3: note: suggested alternative: 'Wire'
wire.begin();
^~~~
Wire
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C
Not used: C:\Users\Harry A\Documents\Arduino\libraries\NewliquidCrystal
Using library Wire at version 1.0 in folder: C:\Users\Harry A\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
Using library LiquidCrystal I2C at version 1.1.2 in folder: C:\Users\Harry A\Documents\Arduino\libraries\LiquidCrystal_I2C
exit status 1

Compilation error: 'wire' was not declared in this scope

Wire.begin(); perhaps?

1 Like

Hi,
What model Arduino are you programming to?

Thanks... Tom.. :grinning: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.