Apparently, conditional includes are always used by the IDE to identify "required" library files. Consider this example:
#if 0
#include <NeoHWSerial.h>
#endif
void setup()
{
Serial.begin( 9600 );
}
void loop() {}
This seems to trick the IDE into linking in NeoHWSerial, even when the condition is FALSE. As a result, HardwareSerial (via 'Serial') conflicts with the incorrectly linked NeoHWSerial. Simply commenting out the NeoHWSerial include removes the "require" of that library, and HardwareSerial links in correctly:
#if 0
//#include <NeoHWSerial.h>
#endif
void setup()
{
Serial.begin( 9600 );
}
void loop() {}
Sigh. This behavior might be related to this. This is still a problem in 1.6.5r2
I opened an issue for this.
Cheers,
/dev