I figured it out and was right. Apparently the compiler is too stupid to notice if you leave off a semicolon in the last line of a file. This causes major problems when it tries to figure out why it can't compile things.
There's nothing like a compiler that has a list of known problems 24 pages long!

I'm not kiding. Look in \mcc18\MPLAB-C18-README.txt