In MSVC, When I write a class with a std::unordered_map member like below,
class DLLEXPORT TTT
{
std::unordered_map<int, int> _map;
};
a C4251 warning is given:
warning C4251: 'TTT::_map' : class 'std::unordered_map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class 'TTT' ...
where DLLEXPORT
macro is in normal pattern, which is expand to __declspec(dllexport)
or __declspec(dllimport)
in the right place.
My question is: if put DLLEXPORT
after this class declaration, the C4251 warning is gone, WHY?
class TTT
{
unordered_map<int, int> _map;
};
class DLLEXPORT TTT;