I'm getting an undeclared identifier error (C2065 on vs2013) on my project, I managed to replicate the problem in the example code below:
foo.h:
#pragma once
#include "bar.h"
class Foo
{
public:
inline void doStuff() { someFunction(); }
};
bar.h:
#pragma once
#include <map>
#include "foo.h"
extern std::map<const char*, Foo> myMap;
void someFunction();
bar.cpp:
#include "bar.h"
std::map<const char*, Foo> myMap;
void someFunction()
{
}
main.cpp:
#include "foo.h"
int main()
{
Foo foo;
foo.doStuff();
return 0;
}
When building on Visual Studio Express 2013, it gives these errors:
error C2065: 'Foo' : undeclared identifier
error C2923: 'std::map' : 'Foo' is not a valid template type argument for parameter '_Ty'
error C3861: 'someFunction': identifier not found
What is the problem here and how can it be solved?