I have set up a library providing an exception class derived from the standard exception:
#include <stdexcept>
#include <string>
class BaseException : public std::runtime_error
{
public:
BaseException( std::string const & msg );
};
So far, so good. Compiles and handles quite well on Unix. Now I am prepping this for compilation into a Windows DLL:
#ifdef WIN32
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
#endif
#include <stdexcept>
#include <string>
class MY_EXPORT BaseException : public std::runtime_error
{
public:
BaseException( std::string const & msg );
};
However, this gives me warning C4275: non – DLL-interface class 'std::runtime_error' used as base for DLL-interface class 'BaseException'
.
And unfortunately, I am somewhat allergic to Microsoft-style documentation: Excessively wordy, and not very to the point. It keeps leaving me utterly confused as to what is actually expected of me to solve my problem.
Can any of you enlighten me? I could just drop the base class, but then catching std::runtime_error
or std::exception
would not catch my custom exception class, and I would very much prefer this to be possible. So...?