7

Here's the code that's making this error:

#include "Wire.h"

Here's the error:

fatal error: Wire.h: No such file or directory
 #include "Wire.h"
                  ^
compilation terminated.
Error compiling.

I also can't include any file from my Arduino\libraries folder. I tried to reinstall the IDE several times in different places and nothing happened. Why is this happening?

EDIT: after some time I discovered that this error occurs in header files only, not in sketches!

9
  • Could you clarify a little more on your setup of the IDE and the full paths to those libraries and if you have any duplicates. Also what is the settings you chose in the Boards menu.
    – RSM
    Jun 28, 2016 at 7:58
  • D:\Arduino\hardware\arduino\avr\libraries\Wire\Wire.h And I chose the Arduino Uno COM3
    – None
    Jun 28, 2016 at 8:03
  • Is the library there header there(I know its an obvious ques). That is where the arduino system should be looking when UNO is chosen
    – RSM
    Jun 28, 2016 at 8:08
  • yes it is there
    – None
    Jun 28, 2016 at 8:45
  • 1
    Change it from #include "Wire.h" to #include <Wire.h>
    – Majenko
    Jun 28, 2016 at 13:11

4 Answers 4

4

Use #include <Wire.h>

Including files in double quotes (") will point to headers in current working directory first.

Edit: ... and there is nothing wrong with copying headers to CWD if you are modifying them, but that's probably not what you want.

0

First go to your library folder and check whether u included that Wire.h header file or not.If not then first include that file then problem will get solved automatically.

1
  • The line that is causing the problem in the include statement, the one you think will fix it. If that's not what you mean please can you clarify your answer? Jul 27, 2016 at 19:29
0

I had a similar issue and found this question. However, the solution for me is different.

I already had #include <Wire.h>, nevertheless the compiler told me it's missing. It turned out, I had selected a wrong board from a previous project. Needed to change to "Arduino Uno".

0

I copy here the answer from https://forum.arduino.cc/t/wire-h-no-such-file-or-directory-solved/297761, cause it worked for me:

It's not enough to put "#include <Wire.h>" in the source file you are using the library in. It seems you must also put "#include <Wire.h>" in the main *.ino file for the sketch as well, before it can be used in any other source code files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.