这真的很琐碎,但我遇到了一个意外的错误。
我有一些代码位于命名空间中。
下面是一些伪代码,表示我的代码结构:
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
}
}
错误:
undefined reference to `A::shake_and_bake`