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!

dda
  • 1,588
  • 1
  • 12
  • 17
None
  • 211
  • 2
  • 3
  • 7

4 Answers4

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.

Code Gorilla
  • 5,637
  • 1
  • 15
  • 31
user400344
  • 348
  • 1
  • 10
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.

  • 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? – Code Gorilla Jul 27 '16 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".

sa_leinad
  • 3,188
  • 1
  • 22
  • 51
JeffRSon
  • 101
  • 2
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.

steph643
  • 101