I have the following setup (hopefully this is not too bare an example):
A.h
typedef std::map<unsigned int, float> MyClass;
extern MyClass inst;
A.cpp
MyClass inst;
B.h
#include <A.h>
void foo();
B.cpp
#include <B.h>
void foo {
inst.myClassFunc();
}
Now, when I use inst in B.cpp
I get undefined reference to inst
.
Any idea on how to fix this?