Simple Audio example does not compile / Teensy4.0 / Arduino

Status
Not open for further replies.

McTime

Member
Hi there,
being new to the Teensy world I already managed to get my ILI9341 display to work. As soon as I add some Audio-Tool generated code the compiler fails at
..\Arduino\libraries\Wire\utility\twi.c:27:24: fatal error: compat/twi.h: No such file or directory
The minimal sample code to get this error is
#include <Audio.h>

Already did a clean reinstall of Arduino+Teensyduino - no cure.
Never ran into this using Arduino-boards.

Any ideas?
Thanks!
 
you have to select Teensy4.0
your error message indicates that you compile for standard Arduino and not Teensy
 
The pathname "Arduino\libraries\Wire\utility\twi.c" means it's trying to use the Wire lib meant for non-Teensy boards. That's the pathname for Arduino's copy of the Wire lib, which definitely does not work with Teensy 4.0. Teensy's version should be Arduino/hardware/teensy/avr/libraries/Wire. Arduino is using the wrong lib, as if it thinks you want to compile for a non-Teensy board.

Why it's doing that, I can't say from only this very limited info you've shown. Maybe you could show us actual screenshots? If you really have Teensy 4.0 selected, the best I can suggest is to reinstall Arduino and Teensyduino. I suggest downloading both, then disconnect from the internet and temporarily turn off Windows Defender and any other anti-virus software while you run both installers.

Actually yes, Teensy 4.0 is selected as the board.
Any other idea?

If you had even told us exactly which example you're trying to compile, I would have run it here and posted a screenshot so you can see it does indeed work when the software is installed properly.

If you really did select Teensy 4.0, it will be shown in the bottom status bar of Arduino's window. The most plausible explanation, which a screenshot showing that bottom status bar could confirm or deny, is the wrong board is selected. A less likely explanation is your Teensyduino install is incomplete or corrupted in some hard to envision way.
 
audio.png
Paul, thanks for your fast response.
Attached is the failed example showing I'm on the teensy.
I traced down the Arduino build-files in the temp-directories, especially compared the two "build.options.json" files regarding libraries. They don't differ, but of them one compiles and runs, the Audio-one does not.

I then remember I installed the Audio-Lib using the Arduino-Libmanager. Could that be a problem?
 
Problem gone. After successfully trying this on an almost naked machine, I went back to my main machine and had to
- remove all whatsover folders named Arduino like App/Local/Temp caches etc.
- remove all libraries I had ever installed (Documents/Arduino/libraries)
Reinstall Arduino, reinstall Teensyduino with option "all libraries".
Still not sure what's causing this, and anxiously awaiting the day I'd need to go back to some older Arduino projects... Thanks for the help.
 
Status
Not open for further replies.
Back
Top