Now in this example, you’ll notice that the word servo changes color when correctly capitalized, and that’s because the library name “Servo” is recognized as a “key word” in the Arduino IDE. So “servo.h” should actually be a capital “S”, or written out, “Servo.h”. Maybe you spelled the name of the library incorrectly, or in this example, maybe you didn’t capitalize the right letters. The first thing you should check is your spelling and capitalization. You’re actually the one who wrote the “#include” line.
What gives? Let’s get to the bottom of this error message and go over two different scenarios. So the error message is like “Hey, programmer, you said I needed this other file… but I looked for it and it’s not there. So our program’s like the label maker and the file (servo) is the roll of labels. If you don’t have that roll of labels, then your label maker isn’t gonna work. To make it work, you have to put in a roll of labels. Let’s say you had a label making machine and you were trying to run the label maker and print some labels. When we verify this code, what this line does is tell the Arduino IDE compiler “Hey, for this program to work, you need to go get this file servo.h”. Well, let’s take a look at line 10 and see what it says. Why are we getting this error? The error of our ways
It says “servo.h: No such file or directory”.
The “19” is a reference to how long that line of code is, so how many spaces or characters long is it. The “10” after “Knob” is the line number (in the Arduino IDE) that the error was detected on. If you look at the Arduino IDE, the the numbers on the left are called line numbers of the program and they’re a reference to help us find where different lines of code are. So, in this case, the name of the program was “Knob”. The first thing it gives us is the name of the program. The second sentence actually starts getting into the error a little bit. The first sentence just says which Arduino version is in use, which operating system is running, and which board is selected. Or you could paste it into a forum and say, “Hey, I’ve got this error message, please help me.”įor this situation, however, we’ve copied it and we’re going to paste it into a text editor so we can take a closer look at what the error message is actually saying. What you can do now is paste it into Google, for example, and do a search which can help you find out more about the error. If you click on it, it copies the error message inside the little window to the clipboard on the computer. If you look at the bottom portion of the Arduino IDE where the error message shows up, there’s this handy little button that says “copy error messages”. Are you trying to run an Arduino sketch, but keep coming across a “No such file or directory” error? This is a pretty common error! Keep watching to learn more about 2 easy fixes for this error.Įrror messages can be such a pain, but they’re supposed to tell us something about the error we made.