I am surprised its random, I didn't think the Arduino IDE creates prototypes for anything except the first tab.
Try adding
extern int readCompass(int);
to test.pde and see if that fixes it.
I still cannot find "extern" in the official documentation
rand--
C++ is a very large, powerful language. Besides "extern", it has many facets which the Arduino website couldn't feasibly document. I think the site is designed to get beginners started without spooking them away with reams of C++ minutiae. The hope is that as your needs grow, you'll turn to other canonical resources to pick up the details.
That's because boolean is an arduino construct, C++ has bool.
I have my doubts about the effectivness of using the Arduino to learn C++. It can be done, but it seems diametrically opposed to the whole concept of hiding the complexities of programming that gave rise to the Arduino.
If I remember right, the problem is that the code that auto-generates function prototypes doesn't yet handle default arguments. It should generate prototypes for functions in all .pde tabs.
After checking, I think that is the only explanation. I tried readCompass() without a default argument and it worked without the prototype.
And apparently I should declare default arguments in the prototype according to the thread here.
Rather interesting. I never had to do this in C++. I had everything in one place and nothing was needed, but decided to switch to multitabbed programming since I wouldn't want to hunt for code.
Ouch. Java is not in my realm, so I don't think I can help any.
Well, the one good thing about prototypes now is that it helps me keep track of what other functions I have on the other tabs. I think I will have many.