OK, this is really annoying. I have the (almost) simplest class possible. Two files: a.cpp and a.h
a.h:
#ifdef A_H
#define A_H
class a{
public:
a();
};
#endif
and a.cpp
#include "a.h"
a::a(){
}
and yet it won’t compile:
g++ a.cpp a.cpp:3: error: ‘a’ has not
been declared
Clearly, I am doing something wrong, but what?
Fixed, I replaced the #ifdef with #ifndef
Its because
needs to be
notice the “n”, as in if NOT defined.
The former will only compile the code if A_H is defined, which it isn’t since you only define it on the next line.