Help with i2c on portenta?

hi guys and girls,
is there anything more to using i2c with the portenta h7 that using the :
#include <Wire.h> ??

im trying to get it working but get the following error messages:

Arduino: 1.8.19 (Windows 10), Board: "Arduino Portenta H7 (M7 core), 1MB M7 + 1MB M4, None"





















C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\wdevo\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\wdevo\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\wdevo\Documents\Arduino\libraries -fqbn=arduino:mbed_portenta:envie_m7:split=50_50,security=none -ide-version=10819 -build-path C:\Users\wdevo\AppData\Local\Temp\arduino_build_695292 -warnings=none -build-cache C:\Users\wdevo\AppData\Local\Temp\arduino_cache_722223 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.openocd.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.openocd-0.11.0-arduino2.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.imgtool.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.imgtool-1.8.0-arduino.1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.dfu-util.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.dfu-util-0.10.0-arduino1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.adb.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -prefs=runtime.tools.adb-32.0.0.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -verbose C:\Users\wdevo\Documents\Arduino\test_compile\test_compile.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\wdevo\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\wdevo\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\wdevo\Documents\Arduino\libraries -fqbn=arduino:mbed_portenta:envie_m7:split=50_50,security=none -ide-version=10819 -build-path C:\Users\wdevo\AppData\Local\Temp\arduino_build_695292 -warnings=none -build-cache C:\Users\wdevo\AppData\Local\Temp\arduino_cache_722223 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.openocd.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.openocd-0.11.0-arduino2.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.imgtool.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.imgtool-1.8.0-arduino.1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.dfu-util.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.dfu-util-0.10.0-arduino1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.adb.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -prefs=runtime.tools.adb-32.0.0.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -verbose C:\Users\wdevo\Documents\Arduino\test_compile\test_compile.ino

Using board 'envie_m7' from platform in folder: C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\3.2.0

Using core 'arduino' from platform in folder: C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\3.2.0

Detecting libraries used...

"C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/defines.txt" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/cxxflags.txt" -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -w -x c++ -E -CC -DARDUINO=10819 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7" -DCM4_BINARY_START=0x08100000 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/includes.txt" "C:\\Users\\wdevo\\AppData\\Local\\Temp\\arduino_build_695292\\sketch\\test_compile.ino.cpp" -o nul

Alternatives for Wire.h: [Wire@1.0 Wire@1.0 Wire@1.0]

ResolveLibrary(Wire.h)

  -> candidates: [Wire@1.0 Wire@1.0 Wire@1.0]

"C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/defines.txt" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/cxxflags.txt" -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -w -x c++ -E -CC -DARDUINO=10819 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7" "-IC:\\Users\\wdevo\\Documents\\Arduino\\libraries\\Wire\\src" -DCM4_BINARY_START=0x08100000 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/includes.txt" "C:\\Users\\wdevo\\AppData\\Local\\Temp\\arduino_build_695292\\sketch\\test_compile.ino.cpp" -o nul

"C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/defines.txt" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/cxxflags.txt" -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -w -x c++ -E -CC -DARDUINO=10819 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7" "-IC:\\Users\\wdevo\\Documents\\Arduino\\libraries\\Wire\\src" -DCM4_BINARY_START=0x08100000 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/includes.txt" "C:\\Users\\wdevo\\Documents\\Arduino\\libraries\\Wire\\src\\Wire.cpp" -o nul

"C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/defines.txt" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/cxxflags.txt" -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -w -x c++ -E -CC -DARDUINO=10819 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7" "-IC:\\Users\\wdevo\\Documents\\Arduino\\libraries\\Wire\\src" -DCM4_BINARY_START=0x08100000 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/includes.txt" "C:\\Users\\wdevo\\Documents\\Arduino\\libraries\\Wire\\src\\utility\\twi.c" -o nul

Alternatives for avr/io.h: []

ResolveLibrary(avr/io.h)\Arduino\libraries\Wire\src\utility\twi.c:25:10: fatal error: avr/io.h: No such file or directory



  -> candidates: []

 #include <avr/io.h>

Multiple libraries were found for "Wire.h"

          ^~~~~~~~~~

 Used: C:\Users\wdevo\Documents\Arduino\libraries\Wire

compilation terminated.

 Not used: C:\Program Files (x86)\Arduino\libraries\Wire

 Not used: C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\3.2.0\libraries\Wire

Using library Wire at version 1.0 in folder: C:\Users\wdevo\Documents\Arduino\libraries\Wire 

exit status 1

Error compiling for board Arduino Portenta H7 (M7 core).


Hi @spruce_m00se. Is there a specific reason you have installed the Wire library to this location?

The "Wire" library is a "platform bundled" library. The installation of each individual Arduino boards platform (e.g., "Arduino Mbed OS Portenta Boards", "Arduino AVR Boards") comes with its own version of the library.

The nature of this library is not something you normally would have to know about because the "Wire" library of each platform uses a compatible API, meaning that a sketch using the API will compile for different boards even though different versions of the libraries are used for each. Only the platform bundled libraries from the platform of the board you are compiling for are accessible, so the correct library for that board will be used automatically.

The reason for this "platform bundled" approach is that the low level I2C bus code the library must contain is architecture specific, meaning that even though the library API is the same from one platform to another, the implementation code may be very different. This is the reason why it wouldn't make sense to attempt to create a single universal "Wire" library installed globally.

You broke all those assumptions when you somehow managed to make a global installation of the AVR-specific version of the library here:

C:\Users\wdevo\Documents\Arduino\libraries\Wire

Although there are theoretically some valid use cases for installing the library there, in my experience it usually turns out that there wasn't a good reason for doing it and only causes problems.

Hi, thanks for your reply,

I have deleted the "global instalation" from the Documents/arduino/libraries/wire.
I have done a fresh up to date intstal of arduino.
it compiles ok for an arduino uno etc, yet for the portenta I now get the following:

Arduino: 1.8.19 (Windows 10), Board: "Arduino Portenta H7 (M7 core), 1MB M7 + 1MB M4, None"





















C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\wdevo\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\wdevo\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\wdevo\Documents\Arduino\libraries -fqbn=arduino:mbed_portenta:envie_m7:split=50_50,security=none -ide-version=10819 -build-path C:\Users\wdevo\AppData\Local\Temp\arduino_build_987493 -warnings=none -build-cache C:\Users\wdevo\AppData\Local\Temp\arduino_cache_934769 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.adb.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -prefs=runtime.tools.adb-32.0.0.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -prefs=runtime.tools.imgtool.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.imgtool-1.8.0-arduino.1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.openocd.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.openocd-0.11.0-arduino2.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.dfu-util.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.dfu-util-0.10.0-arduino1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -verbose C:\Users\wdevo\Documents\Arduino\test_compile\test_compile.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\wdevo\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\wdevo\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\wdevo\Documents\Arduino\libraries -fqbn=arduino:mbed_portenta:envie_m7:split=50_50,security=none -ide-version=10819 -build-path C:\Users\wdevo\AppData\Local\Temp\arduino_build_987493 -warnings=none -build-cache C:\Users\wdevo\AppData\Local\Temp\arduino_cache_934769 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.adb.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -prefs=runtime.tools.adb-32.0.0.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\adb\32.0.0 -prefs=runtime.tools.imgtool.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.imgtool-1.8.0-arduino.1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\imgtool\1.8.0-arduino.1 -prefs=runtime.tools.openocd.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.openocd-0.11.0-arduino2.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.dfu-util.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.dfu-util-0.10.0-arduino1.path=C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -verbose C:\Users\wdevo\Documents\Arduino\test_compile\test_compile.ino

Using board 'envie_m7' from platform in folder: C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\3.2.0

Using core 'arduino' from platform in folder: C:\Users\wdevo\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\3.2.0

Detecting libraries used...

"C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/defines.txt" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/cxxflags.txt" -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -w -x c++ -E -CC -DARDUINO=10819 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7" -DCM4_BINARY_START=0x08100000 "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated" "-IC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\cores\\arduino" "@C:\\Users\\wdevo\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_portenta\\3.2.0\\variants\\PORTENTA_H7_M7/includes.txt" "C:\\Users\\wdevo\\AppData\\Local\\Temp\\arduino_build_987493\\sketch\\test_compile.ino.cpp" -o nul

Alternatives for Wire.h: []

ResolveLibrary(Wire.h)

  -> candidates: []test_compile:7:10: fatal error: Wire.h: No such file or directory



 #include <Wire.h>

          ^~~~~~~~

compilation terminated.

exit status 1

Wire.h: No such file or directory

Now your Arduino IDE can not find any "Wire.h" at all.

I took the new Arduino IDE 2.0.0-rc9.2, then I installed the board "Arduino Mbed OS Portenta Boards by Arduino", then I choose Portenta H7 (M7 core), and it compiled without problem, although I do not know why it would say: "legacy".

Using library Wire in folder: .....arduino15/packages/arduino/hardware/mbed_portenta/3.2.0/libraries/Wire (legacy)

The location of "arduino15" depends on your operating system, but that is where the downloaded build environment for boards are stored.

I will uninstal and reinstal the portenta boards and see what happens

... that seems to have done the trick
i dont quite know how the libraries included with the portenta got changed, i suppose that I must have done so whilst attempting to solve the original issue before posting here.

in summary , i think the secanrio was the following:
global wire.h included in the libraries folder some 10 years or so ago......
some tomfoolery with the wire.h for the portenta, then deleting it, and the compiler went back to the global one.

either way, resintalling arduino, desinstalling and installing the portenta board again, seems to have solved the issue,

thank you every one for your help!!

"legacy" means the library has an older file structure. This is actually referred to as "1.0 format" in the library specification, since it was the way all libraries were during the Arduino IDE 1.0.x era:

https://arduino.github.io/arduino-cli/latest/library-specification/#old-library-format-pre-15

You can see the structure here:

Wire/
├── Wire.cpp
└── Wire.h

The modern library structure, with "1.5 format", and "recursive layout" would look like this:

Wire/
├── library.properties
└── src/
    ├── Wire.cpp
    └── Wire.h

In the case of standalone libraries, it is important for library developers to use the 1.5 format because this is a requirement if they want to submit the library for inclusion in the Arduino Library Manager. But "platform bundled" libraries like this Wire are not distributed via Library Manager, and the "1.0 format" is supported even by the modern development software, so use of the new format is not required. and use of the old format doesn't do any harm.