I am trying to #include <Wire.h>, but the error still comes that Compilation error: Wire.h: No such file or directory. I did some research and apparently it is included with AVR boards and I am using an Arduino Uno. How can I fix this?
Hi @mikchip. I'm going to ask you to provide the full verbose output from a compilation.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
- Select File > Preferences...(or Arduino > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open. - Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
- Click the "OK" button.
The "Preferences" dialog will close. - Select Sketch > Verify/Compile from the Arduino IDE menus.
- After the compilation fails you'll see a button on the right side of the orange bar in Arduino IDE: Copy error messages. Click that button.
This copies the full output to the clipboard. - Open a forum reply here by clicking the "Reply" button.
- 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.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the compilation output into the code block. - Move the cursor outside of the code block markup before you add any additional text to your reply.
- 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.
Click here for attachment instructions
- Open any text editor program.
- Paste the copied output into the text editor.
- Save the file in
.txt
format. - Open a forum reply here by clicking the "Reply" button.
- Click the "Upload" icon () on the post composer toolbar:
The "Open" dialog will open. - Select the
.txt
file you saved from the "Open" dialog. - Click the "Open" button.
The dialog will close. - 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.
This happened to me once with a different arduino default library, what i did to fix it was save the file first then compile, i also rechecked if the .h file was in the code folder