Monthly Archives: July 2015

Arduino fatal error: SoftwareSerial.h No such file or directory

I’ve been working with Arduino a lot lately, and ran into an extremely bizarre error:

Usually, when you’re adding a new library, you need to follow specific instructions[1] about how to install that library in the Arduino IDE. So, if you’re getting this error with a non-standard Arduino library (like the Neopixel library, or something you’ve downloaded from the Internet), this error makes perfect sense. But SoftwareSerial is included with the Arduino IDE: It’s a built-in library[2]. So how on earth could it not be found? I was especially confused since I had uploaded this code not two days ago!

Here’s what I tried:

  1. Checking that SoftwareSerial was indeed installed in my Arduino IDE application (These instructions are for a Mac, since that’s what I own):
    1. Select the Arduino application
    2. Chose ‘Show package Contents’ – a new window will appear.
    3. Now navigate to:
      1. Contents
      2. Resources
      3. Java
      4. hardware
      5. libraries
    4. All the standard libraries will be there.
  2. Moving the entire SoftwareSerial directory from that standard location above, to the location where all installed libraries are installed on my Mac (other included libraries were installing fine):
    1. Documents/Arduino/libraries
  3. Restarting Arduino IDE multiple times.
  4. Downloading a completely new version of the IDE.
  5. Restarting my computer.

Nothing worked: and the fact that downloading a completely new version of the IDE didn’t solve the issue meant that it was some issue with the way my Arduino/libraries folder was set up. Finally, I remembered that for another project I had edited SoftwareSerial so that it didn’t use any pins on PortD, and included that in my libraries as SoftwareSerialNoPortD. I thought that might be messing things up. A forum post taught me that if you open up the Arduino IDE and go to Sketch->IncludeLibrary… the IDE will automatically generate the import statement:

When I tried to automatically import SoftwareSerial, this is what showed up in my sketch:

Somehow, the IDE had linked SoftwareSerial with SoftwareSerialNoPortD, and couldn’t find SoftwareSerial anymore. I checked through all the files to make sure everything was named properly, and eventually found this file called

I edited it so that it had the correct name for SoftwareSerialPortD:

Quit and restarted the Arduino IDE, and now I’m able to compile fine!


Leave a comment

Posted by on Saturday, July 25, 2015 in fractally weird