SoftwareSerial library
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.