This is really trivial but I’m getting an error I didn’t expect.
I have some code which is inside of a namespace
the following is some pseudocode that represents the structure of my code:
namespace A {
void init() {
initialize_kitchen_sink();
}
#include "operations.h" // declares shake_and_bake()
void foo() {
shake_and_bake();
}
void cleanup() {
// do nothin' cuz i'm a slob
}
}
error:
undefined reference to `A::shake_and_bake`
Turns out moving the
#includeoutside the namespace will fix it.As it was, the include would be in effect declaring all of the functions in
operations.hinside theAnamespace. Then it would search in vain for the implementations.I figure instead of deleting my entire post i may as well leave it for that minute possibility that someone else may stumble upon a similar problem and be enlightened.