Ich kam in den folgenden Code auf VS2008Ausnahmeklasse mit einem char * Konstruktor
if (!CreateProcess(NULL,
const_cast<LPWSTR>(ss.str().c_str()),
NULL,
NULL,
FALSE,
CREATE_NO_WINDOW|NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&si,
&pi))
{
throw std::exception("Unable to format Device");
}
Jetzt bin ich um den Code zu mingw gcc Portierung und erhalte ich die Fehler
error: no matching function for call to 'std::exception::exception(const char [23])'
das Problem Untersuchung I bemerkte, dass Visual Studio eine Dateiausnahme hat, die eine Ausnahmeklasse hat und char * aufnimmt. Einige der Definitionen wie folgt aussehen
__CLR_OR_THIS_CALL exception();
__CLR_OR_THIS_CALL exception(const char *const&);
__CLR_OR_THIS_CALL exception(const char *const&, int);
__CLR_OR_THIS_CALL exception(const exception&);
exception& __CLR_OR_THIS_CALL operator=(const exception&);
virtual __CLR_OR_THIS_CALL ~exception();
virtual const char * __CLR_OR_THIS_CALL what() const;
Meine Frage ist, wie soll ich das Build-Problem auf mingw gcc umgehen? Soll ich eine neue Klasse erstellen, die von std :: runtime_error erbt und diese stattdessen wirft?
'std :: Ausnahme :: Ausnahme (const Char *)' ist kein C++ - Standard, eher eine MS spezifische Implementation http://en.cppreference.com/w/cpp/error/exception/exception –