0

How do I rectify this error? Clearly it says there is some error in the library, so how do I correct it?

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:1: error: expected unqualified-id before 'if'

yash jain
  • 1
  • 2

2 Answers2

1

As you haven't shown the code that produces the error when it's compiled, I can't say for sure what the problem is. However, here are links to three instances of the same error:

error: expected unqualified-id before 'if' on stackoverflow

Arduino: error: expected unqualified-id before 'if' (using ping sensor), also on stackoverflow

error: expected unqualified-id before 'if' on arduino.cc.

In each case, the problem was due to executable code (as opposed to declarations) appearing outside of a function. You may have put some executable statements outside of loop() or setup(), etc.

James Waldby - jwpat7
  • 8,910
  • 3
  • 20
  • 33
0

Your copy of the SoftwareSerial library has become corrupted. Why is anyone's guess: maybe your hard drive is dying?

Replacing the file with a good copy will solve the problem. The simplest way to do that is to reinstall the IDE.

Majenko
  • 105,761
  • 5
  • 80
  • 138