my project working fine , when change in header file got error:
error c2065 'map': undeclared identifier
although did #include <map>
part of game.h:
#include <map> class game{ game(); }
the line gives me error in game.cpp:
_results.insert(map<std::string, int>::value_type(_players[i]->getusername(), 0));
this code line worked fine ! until point
my guess @ 1 point, either had class named map
in global namespace, provided interface similar std::map
, or more likely, relying on using namespace std;
directive has since been removed (whether unintentionally or not; perhaps else had 1 in header using, removed when realised bad idea). either put using-directive std
or using-declaration std::map
in code block containing line, or explicitly use std::map
whenever want use c++ standard library map
class; latter recommended, because makes code clearer , cleaner.
if using custom map
class before, check header still #include
d, , doesn't run same namespace issue.
Comments
Post a Comment