I have driver.h
which contains:
namespace org::lib{
extern bool masterBool;
}
And a library.h
which contains an anonymous namespace that defines masterBool
:
namespace {
bool masterBool = false;
std::string otherFunction(){
//....
}
}
My driver.cpp
which calls the otherFunction()
and masterBool
:
#include driver.h
#include library.h
namespace org::lib{
void function(){
otherFunction();
if (masterBool){
//.....
}
}
}
Upon compiling, I'm getting a undefined symbol: org::lib::masterBool
in my driver.cpp
. However, otherFunction()
call did not such an error, even though they are both defined in the anonymous namespace of library.h
What am I missing here?