I'm playing around with Box2D for fun right now, and after getting the hang of some of the concepts I decided to make my own test for the test bed (Box2D comes with a set of examples and has a simple extendable Test class for making your own tests). I started by grabbing one of the other tests, ripping out everything but the function signatures, and inserting some of my own code.
However, there's no #includes to any of Box2D's libraries so it doesn't compile (but only my file errors, remove my test file and it compiles fine). I figured I must have accidentally deleted them when I was moving stuff around, but upon checking the other test files there's no #includes anywhere to be seen. Each one of the files uses datastructures and functions that are declared in various Box2D header files. How does this compile at all?
For example, this is one of the prepackaged tests stripped of the constructor body and some comments at the top:
#ifndef CHAIN_H
#define CHAIN_H
class Chain : public Test
{
public:
Chain()
{
// Since b2BodyDef isn't defined in this file, and no
// other files are included how does this even compile?
b2BodyDef bd;
// rest of constructor...
}
static Test* Create()
{
return new Chain;
}
};
#endif