How to figure out why wire.h library cannot be found?-[SOLVED]

Iam trying to compile the example sketch HelloWorldi2c from the LiquidCrystal_I2C.h library but the compiler complains about the wire.h library.
Interestingly, there is no similar problem when I compile other sketches using wire.h

It appears that the wire.h is not found. Its probably something trivial but I am stack :slight_smile:

Here's the output:

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\John\AppData\Local\Arduino15\packages -hardware D:\Dropbox\MCU\Controller_Firmware\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\John\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\Dropbox\MCU\Controller_Firmware\libraries -fqbn=MightyCore:avr:1284:bootloader=uart0,pinout=standard,variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external -vid-pid=0403_6001 -ide-version=10812 -build-path C:\Users\John\AppData\Local\Temp\arduino_build_10386 -warnings=all -build-cache C:\Users\John\AppData\Local\Temp\arduino_cache_99456 -prefs=build.warn_data_percentage=75 -verbose C:\Users\John\AppData\Local\Temp\arduino_modified_sketch_529893\HelloWorld_i2c.pde
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\John\AppData\Local\Arduino15\packages -hardware D:\Dropbox\MCU\Controller_Firmware\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\John\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\Dropbox\MCU\Controller_Firmware\libraries -fqbn=MightyCore:avr:1284:bootloader=uart0,pinout=standard,variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external -vid-pid=0403_6001 -ide-version=10812 -build-path C:\Users\John\AppData\Local\Temp\arduino_build_10386 -warnings=all -build-cache C:\Users\John\AppData\Local\Temp\arduino_cache_99456 -prefs=build.warn_data_percentage=75 -verbose C:\Users\John\AppData\Local\Temp\arduino_modified_sketch_529893\HelloWorld_i2c.pde
Using board '1284' from platform in folder: C:\Users\John\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.0.3
Using core 'MCUdude_corefiles' from platform in folder: C:\Users\John\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.0.3
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "C:\\Users\\John\\AppData\\Local\\Temp\\arduino_build_10386\\sketch\\HelloWorld_i2c.pde.cpp" -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
  -> candidates: [Wire@1.0]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src" "C:\\Users\\John\\AppData\\Local\\Temp\\arduino_build_10386\\sketch\\HelloWorld_i2c.pde.cpp" -o nul
Alternatives for LiquidCrystal_I2C.h: [LiquidCrystal_I2C]
ResolveLibrary(LiquidCrystal_I2C.h)
  -> candidates: [LiquidCrystal_I2C]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src" "-ID:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C" "C:\\Users\\John\\AppData\\Local\\Temp\\arduino_build_10386\\sketch\\HelloWorld_i2c.pde.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src" "-ID:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C" "C:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src\\Wire.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src" "-ID:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C" "C:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src\\utility\\twi.c" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src" "-ID:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C" "D:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C\\FastIO.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_ATmega1284 -DARDUINO_ARCH_AVR "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\variants\\standard" "-IC:\\Users\\John\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.0.3\\libraries\\Wire\\src" "-ID:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C" "D:\\Dropbox\\MCU\\Controller_Firmware\\libraries\\LiquidCrystal_I2C\\I2CIO.cpp" -o nul
Alternatives for ../Wire/Wire.h: []
ResolveLibrary(../Wire/Wire.h)
D:\Dropbox\MCU\Controller_Firmware\libraries\LiquidCrystal_I2C\I2CIO.cpp:35:10: fatal error: ../Wire/Wire.h: No such file or directory
  -> candidates: []

 #include <../Wire/Wire.h>

          ^~~~~~~~~~~~~~~~

compilation terminated.

Using library Wire at version 1.0 in folder: C:\Users\John\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.0.3\libraries\Wire 
Using library LiquidCrystal_I2C in folder: D:\Dropbox\MCU\Controller_Firmware\libraries\LiquidCrystal_I2C (legacy)
exit status 1
Error compiling for board ATmega1284.
D:\Dropbox\MCU\Controller_Firmware\libraries\LiquidCrystal_I2C\I2CIO.cpp:35:10: fatal error: ../Wire/Wire.h: No such file or directory
  -> candidates: []

 #include <../Wire/Wire.h>

At a guess the library is looking in the wrong place for Wire.h, probably one folder too deep

Please post the complete code for I2CIO.cpp

Please show your sketch.
Probably you have included a library (LiquidCrystal_I2C.h) that includes wire.h. but you haven't included wire.h in your sketch which makes the compiler look for wire.h in the folder (or sub-folders) of the .h file in which wire.h is included. easiest solution is to include wire.h in your main sketch.

UKHeliBob:

D:\Dropbox\MCU\Controller_Firmware\libraries\LiquidCrystal_I2C\I2CIO.cpp:35:10: fatal error: ../Wire/Wire.h: No such file or directory

-> candidates: []

#include <../Wire/Wire.h>



At a guess the library is looking in the wrong place for Wire.h, probably one folder too deep

Please post the complete code for I2CIO.cpp

You are right!

The Library was calling for

#include <../Wire/Wire.h>

I changed it to

#include <Wire.h>

and now it compiles!

Wonder why that was in the first place though...

Deva_Rishi:
Please show your sketch.
Probably you have included a library (LiquidCrystal_I2C.h) that includes wire.h. but you haven't included wire.h in your sketch which makes the compiler look for wire.h in the folder (or sub-folders) of the .h file in which wire.h is included. easiest solution is to include wire.h in your main sketch.

Thanks for your input but I found that it was a problem of the LiquidCrystal_I2C.h looking for wire.h in the wrong place...
I had included wire.h in my sketch