I get this warning when compiling my code in VS2008
warning C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface class 'MyException' 2> c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdexcept(148) : see declaration of 'std::runtime_error'
My class is defined as
class MyException : public std::runtime_error
If you want to turn it on (or off) in the project setting, you have to go to: Configuration Properties -> C/C++ -> Command Line and then under Additional Options you can enter: /w3#### to set your warning to level 3, and thus enable it; or you can enter /wd#### to disable a warning.
Compiler warnings are messages produced by a compiler regarding program code fragments to be considered by the developer, as they may contain errors. Unlike compilation errors, warnings don't interrupt the compilation process.
MSDN: http://msdn.microsoft.com/en-us/library/3tdb471s.aspx
"An exported class [as in DLL] was derived from a class that was not exported [as in DLL]."
Apparently you are declaring MyException
to be exportable from a DLL (by using: __declspec(dllexport)
), while std::runtime_error
is not exportable. Consider if MyException
really needs to be exportable. However, if none of the issues listed on the above page apply to your specific case, then you can disregard that warning--just be aware of the issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With