0

OgrePrerequisites.h

#define _OgreExport __declspec( dllexport )

template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> > 
struct map 
{ 
   typedef typename std::map<K, V, P, A> type;
   typedef typename std::map<K, V, P, A>::iterator iterator;
   typedef typename std::map<K, V, P, A>::const_iterator const_iterator;
}

OgreLogManager.h

class _OgreExport LogManager
{
protected:
    typedef map<String, Log*>::type LogList;
    /// A list of all the logs the manager can access
    LogList mLogs;
};

The LogManager use std::map, but when I built the project, I didn't get any C4251 warning:

**class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class**

I want to know how Ogre eliminates the C4251 warning?

smerlin
  • 6,446
  • 3
  • 35
  • 58

1 Answers1

0

They explicitly disable certain warnings with #pragma warning. As mentioned on MSDN, the usual approach is to disable warnings locally with combination of

#pragma warning( push )
#pragma warning( disable : 4705 )
// Some code
#pragma warning( pop )

To restore original warning settings. They restore warning settings in OgreHeaderSuffix.h, so these warnings are disabled for library code only.

dewaffled
  • 2,850
  • 2
  • 17
  • 30