Compilation error: no such file or directory

I'm using a Nano 33 BLE Sense Lite. I have "Arduino Nano 33 BLE" as my board and "COM4" as my port. I am able to successfully upload an example blink (from file --> examples --> basics --> blink), but when I try to upload (from file --> examples --> Harvard_TinyMLx (under "examples from custom libraries") --> magic_wand), I'm getting the following error:

In file included from C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023619-15524-1m1qk0q.06h5h\magic_wand\magic_wand.ino:23:0:
C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023619-15524-1m1qk0q.06h5h\magic_wand\imu_provider.h:4:10: fatal error: Arduino_LSM9DS1.h: No such file or directory
 #include <Arduino_LSM9DS1.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: Arduino_LSM9DS1.h: No such file or directory

I tried looking this up and it says it's because I don't have a particular library installed, but if that was the case, then I shouldn't even be able to upload blink (which I was).

Edit: I'll also note that I also tried to upload hello_world (from file --> examples --> Harvard_TinyMLx (under "examples from custom libraries") --> hello_world) and person_detection (from file --> examples --> Harvard_TinyMLx (under "examples from custom libraries") --> person_detection) and I was able to upload both successfully.

I'm using this guide: How to Build a Magic Wand - Google Slides (I'm currently on slide 10)

Blink example requires no library.

Please consult the instructions for installing a library, available on this site. It's an automatic process built in to the IDE now, better than the old manual installations...

Can you provide a link, please? I searched it up and I'm seeing different versions of guides and I'm not quite certain which one you're referring to.

Also, do the hello_world and person_detection not require libraries either? Again, I was able to upload those two successfully.

It's very likely, the guide you are using, does ask you to install a library and probably tells you how to do it. You probably just missed it - go back and look.

Do they have any "#include" statements like the one in your error message? :wink:

It does include that (on slide 7, see link edited into my original post), and I did do the process. The only difference is the version of Harvard_TinyMLx I used (but I tried both the most UTD version and the one the guide uses and the result is the same either way).

And no, they didn't have #include (so I'm guessing it means they don't require the library).

Okay, I figured it out. It's because I need <TensorFlowLite.h>, which the library no longer includes.

Okay, I'm getting another issue. I'm trying to run the magic wand example from Harvard_TinyMLx but I'm having issues with <TensorFlowLite.h> since it used to be a downloadable library package from arduino but not anymore. I know that now, we need to download manually from GitHub - adafruit/Adafruit_TFLite: TensorFlow light helper class for Adafruit & Arcada boards, but when I run it now, I get the following error:

C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023619-15524-1m1qk0q.06h5h\magic_wand\magic_wand.ino:15:10: fatal error: tensorflow/lite/micro/micro_error_reporter.h: No such file or directory
 #include "tensorflow/lite/micro/micro_error_reporter.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: tensorflow/lite/micro/micro_error_reporter.h: No such file or directory

I'm guessing it's because the Adafruit version doesn't have directories that are the exact same name as the original tensorflowlite version but I'm also not seeing any clear equivalents. Is there a way to resolve this issue?

Hi @jkim7. I'm going to ask you to post the full verbose output from a compilation.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to fail.
  6. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
  7. Open a forum reply here by clicking the Reply button.
  8. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code tags icon on toolbar
  9. Press Ctrl+V.
    This will paste the compilation output into the code block.
  10. Move the cursor outside of the code tags before you add any additional text to your reply.
  11. Click the Reply button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the Reply button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:
    Upload icon on toolbar
    A dialog will open.
  6. In the dialog, select the .txt file you saved.
  7. Click the Open button.
  8. Click the Reply button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

FQBN: arduino:mbed_nano:nano33ble
Using board 'nano33ble' from platform in folder: C:\Users\ual-laptop\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.2
Using core 'arduino' from platform in folder: C:\Users\ual-laptop\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.2

loading library from C:\Users\ual-laptop\Documents\Arduino\libraries\git: invalid library: no header files found
Detecting libraries used...
"C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/defines.txt" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/cxxflags.txt" -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_ARDUINO_NANO33BLE -DARDUINO_ARCH_MBED_NANO -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/includes.txt" "C:\\Users\\ual-laptop\\AppData\\Local\\Temp\\arduino\\sketches\\B1FE737CE8B76B56928C5FD907747E8A\\sketch\\magic_wand.ino.cpp" -o nul
Alternatives for TensorFlowLite.h: [Adafruit TFLite Micro Speech@1.16.1 Harvard_TinyMLx@1.2.3-Alpha]
ResolveLibrary(TensorFlowLite.h)
  -> candidates: [Adafruit TFLite Micro Speech@1.16.1 Harvard_TinyMLx@1.2.3-Alpha]
"C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/defines.txt" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/cxxflags.txt" -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_ARDUINO_NANO33BLE -DARDUINO_ARCH_MBED_NANO -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE" "-IC:\\Users\\ual-laptop\\Documents\\Arduino\\libraries\\Harvard_TinyMLx\\src" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/includes.txt" "C:\\Users\\ual-laptop\\AppData\\Local\\Temp\\arduino\\sketches\\B1FE737CE8B76B56928C5FD907747E8A\\sketch\\magic_wand.ino.cpp" -o nul
Alternatives for Arduino_LSM9DS1.h: []
ResolveLibrary(Arduino_LSM9DS1.h)
  -> candidates: []
In file included from C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023620-10536-188ialn.x7dv\magic_wand\magic_wand.ino:23:0:
C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023620-10536-188ialn.x7dv\magic_wand\imu_provider.h:4:10: fatal error: Arduino_LSM9DS1.h: No such file or directory
 #include <Arduino_LSM9DS1.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Multiple libraries were found for "TensorFlowLite.h"
  Used: C:\Users\ual-laptop\Documents\Arduino\libraries\Harvard_TinyMLx
  Not used: C:\Users\ual-laptop\Documents\Arduino\libraries\Adafruit_TFLite_Micro_Speech
Using library Harvard_TinyMLx at version 1.2.3-Alpha in folder: C:\Users\ual-laptop\Documents\Arduino\libraries\Harvard_TinyMLx 
exit status 1

Compilation error: Arduino_LSM9DS1.h: No such file or directory

Try removing that line from magic_wand.ino

@johnwasser here's what I'm getting now:

FQBN: arduino:mbed_nano:nano33ble
Using board 'nano33ble' from platform in folder: C:\Users\ual-laptop\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.2
Using core 'arduino' from platform in folder: C:\Users\ual-laptop\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.2

loading library from C:\Users\ual-laptop\Documents\Arduino\libraries\git: invalid library: no header files found
Detecting libraries used...
"C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/defines.txt" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/cxxflags.txt" -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_ARDUINO_NANO33BLE -DARDUINO_ARCH_MBED_NANO -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/includes.txt" "C:\\Users\\ual-laptop\\AppData\\Local\\Temp\\arduino\\sketches\\B1FE737CE8B76B56928C5FD907747E8A\\sketch\\magic_wand.ino.cpp" -o nul
Alternatives for TensorFlowLite.h: [Harvard_TinyMLx@1.2.3-Alpha Adafruit TFLite Micro Speech@1.16.1]
ResolveLibrary(TensorFlowLite.h)
  -> candidates: [Harvard_TinyMLx@1.2.3-Alpha Adafruit TFLite Micro Speech@1.16.1]
"C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/defines.txt" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/cxxflags.txt" -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_ARDUINO_NANO33BLE -DARDUINO_ARCH_MBED_NANO -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE" "-IC:\\Users\\ual-laptop\\Documents\\Arduino\\libraries\\Harvard_TinyMLx\\src" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "@C:\\Users\\ual-laptop\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/includes.txt" "C:\\Users\\ual-laptop\\AppData\\Local\\Temp\\arduino\\sketches\\B1FE737CE8B76B56928C5FD907747E8A\\sketch\\magic_wand.ino.cpp" -o nul
Alternatives for Arduino_LSM9DS1.h: []
ResolveLibrary(Arduino_LSM9DS1.h)
  -> candidates: []
In file included from C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023620-10536-188ialn.x7dv\magic_wand\magic_wand.ino:23:0:
C:\Users\ual-laptop\AppData\Local\Temp\.arduinoIDE-unsaved2023620-10536-188ialn.x7dv\magic_wand\imu_provider.h:4:10: fatal error: Arduino_LSM9DS1.h: No such file or directory
 #include <Arduino_LSM9DS1.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Multiple libraries were found for "TensorFlowLite.h"
  Used: C:\Users\ual-laptop\Documents\Arduino\libraries\Harvard_TinyMLx
  Not used: C:\Users\ual-laptop\Documents\Arduino\libraries\Adafruit_TFLite_Micro_Speech
Using library Harvard_TinyMLx at version 1.2.3-Alpha in folder: C:\Users\ual-laptop\Documents\Arduino\libraries\Harvard_TinyMLx 
exit status 1

Compilation error: Arduino_LSM9DS1.h: No such file or directory

Select Tools -> Manage Libraries...
In the "Filter your search..." box put LSM9DS1.
Scroll down to "Arduino LSM9DS1 Library" and click on the "INSTALL" button.

In order to fix this error, you must install the "Arduino_LSM9DS1" library. I'll provide instructions you can follow to do that:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. In the "Filter your search" field, type Arduino_LSM9DS1
  3. Scroll down through the list of libraries until you see the "Arduino_LSM9DS1" entry.
  4. You will see an "INSTALL" button at the bottom of the entry. Click the button.
  5. Wait for the installation to finish.

We can see the explanation here:

The "Harvard_TinyMLx" library includes a bundled copy of TensorFlow Lite. This is done because the API of the TensorFlow Lite library seems to be in a state of constant change, meaning that code developed with one version of the TensorFlow Lite library will likely not work for a user who has a different version of the TensorFlow Lite library installed. By bundling the specific version of TensorFlow Lite the "Harvard_TinyMLx" library was written for, they can be sure that the user will have access to the appropriate dependency.

However, if you install a standalone copy of the TensorFlow Lite library, that can cause Arduino IDE to use that other installation of TensorFlow Lite instead of the one bundled with the "Harvard_TinyMLx" library. That is what happened to you.

If you don't have any specific need for the "Adafruit TFLite Micro Speech" library, you can solve the problem by uninstalling that library. I'll provide instructions:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. In the "Filter your search" field, type Adafruit TFLite Micro Speech
  3. Scroll down through the list of libraries until you see the "Adafruit TFLite Micro Speech" entry.
  4. Hover the mouse pointer over the "Adafruit TFLite Micro Speech" entry.
  5. You will see a ●●● icon appear near the top right corner of the library entry. Click on that icon.
    A context menu will open.
  6. Select "Remove" from the context menu.
    An "Uninstall" dialog will open.
  7. Click the "YES" button in the "Uninstall" dialog to confirm that you want to uninstall the library.
  8. Wait for the uninstall process to finish.

Now try compiling the "magic_wand" example sketch again.

I had to install a couple other things in the process but it worked in the end. Thank you!!!

You are welcome. I'm glad it is working now.

Regards,
Per

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