she swears <i>geek</i> is a term of endearment

Learning to ignore “syntax error before”

My brilliant tidbit of iPhone SDK advice today is to ignore the message that xCode gives you when compilation fails and just accept that something is messed up and now you need to put on your utility boots and start digging

There aren’t very many different compiler error messages, so “syntax error before” should be read as “start here and work back”

My issue today was that I had a circular reference.  The problem manifested itself as the above error message.  The actual line where the build result console pointed me to had absolutely nothing to do with the problem. 

How DID I find the problem?  I started deleting s#&@.&nbsp; I started from the line that was listed in the compiler error.  I’d delete that line, build.  The “syntax error before” would go away but now I had an undeclared variable.  I’d delete an #import.  build.  AFter going to lunch and proceeding with this approach for about two hours, I deleted an #import in a file three imports away and 80 errors suddenly popped up.  Yep every single one of them “syntax error before”.

The solution was simple but not very exciting.  leave the #import in the “.m” file unless it is part of the interface.

So there is my second tidbit today: don’t #import anything into you “.h” that your “.h” don’t need.

Leave a Reply