Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. STL in DLL's

STL in DLL's

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jawache
    wrote on last edited by
    #1

    I have a DLL class that I am exporting, // Observer Class class APA_API CStateObserver { ... } class APA_API CStateMachine { public: void PushObserver(CStateObserver * inpObserver); private: std::deque m_dqObservers; } APA_API is the define that resolves to the correct __dellspec(lalalalalal) etc... I get this compiler warning message, warning C4251: 'm_dqObservers' : class 'std::deque >' needs to have dll-interface to be used by clients of class 'CStateMac I have 'Warnings as Errors' set so this warning is a real problem. What are my options? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net

    V J 2 Replies Last reply
    0
    • J Jawache

      I have a DLL class that I am exporting, // Observer Class class APA_API CStateObserver { ... } class APA_API CStateMachine { public: void PushObserver(CStateObserver * inpObserver); private: std::deque m_dqObservers; } APA_API is the define that resolves to the correct __dellspec(lalalalalal) etc... I get this compiler warning message, warning C4251: 'm_dqObservers' : class 'std::deque >' needs to have dll-interface to be used by clients of class 'CStateMac I have 'Warnings as Errors' set so this warning is a real problem. What are my options? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      Did you include the header for the deque container? Kuphryn

      1 Reply Last reply
      0
      • J Jawache

        I have a DLL class that I am exporting, // Observer Class class APA_API CStateObserver { ... } class APA_API CStateMachine { public: void PushObserver(CStateObserver * inpObserver); private: std::deque m_dqObservers; } APA_API is the define that resolves to the correct __dellspec(lalalalalal) etc... I get this compiler warning message, warning C4251: 'm_dqObservers' : class 'std::deque >' needs to have dll-interface to be used by clients of class 'CStateMac I have 'Warnings as Errors' set so this warning is a real problem. What are my options? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net

        J Offline
        J Offline
        Jim Crafton
        wrote on last edited by
        #3

        disable it - I think this is one of the ones you can safely ignore (like warning 4786 about long names) Also make sure you don't expose it directly, such as

        class Foo {
        public:
        map<int,int> & getTheIntMap() {
        return m_map;
        }

        private:
        map<int,int> m_map;
        }

        exposing it like so will cause you all sorts of problems - just don't go there. Wrap all access to the collection with functions for adding and removing, which it appears you are doing anyways. Also you might consider using STLPort - which may give you fewer headaches ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups