You must instantiate sampledMap somewhere |
Somewhere that preferably is not a header file, because headers can be included into multiple translation units and a definition may not exist in more than one.
One obviously will have to link all necessary object files.
The use of global variables (like smapledMap) is usually discouraged, because they restrict the program (in addition to issues that you did encounter).
CPlusPlusNoobie1 wrote: |
---|
The exact error is :
error C2512: 'Oracle' : no appropriate default constructor available. |
|
While I have no love for the build system that you do use, I still do know that that compiler can say more. It mentions filename and line number. Or should.
While some syntax errors mess compiler's heuristics so badly that it fails to point to the spot of the real error, compiler generally does good job at it. In this case, did it point to file A.h and line that has that:
Oracle oracle;
(An another global variable?)
That code was relevant for debugging and so was the definition of
class Oracle
too. A class has multiple members (constructors and the destructor) that the compiler generates automatically, if they have not been explicitly written. However, not always. The rules were relatively simple before C++11 and its move constructors. One is that if a class has any constructor, then compiler does not create the default constructor at all.