W8126 Base class of exported class should have exported constructor (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

This message occurs when the base class does not export its constructor. Therefore, when instantiating any derived classes, they cannot call the constructor for the base class before calling the constructor for the derived classes.

   class Base{
     public:
       
   };
   class __declspec(dllexport) Derived{
     public:
       Derived(){};
   };
   int main(int , char** )
   {
       Derived d; //Warning
   }