mi sono imbattuto il seguente codice in VS2008classe Exception con un char * costruttore
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");
}
Ora sto porting del codice per MinGW gcc e ottengo l'errore
error: no matching function for call to 'std::exception::exception(const char [23])'
Analizzare il problema I ho notato che Visual Studio ha un'eccezione di file che ha una classe di eccezione e accetta char *. Alcune delle definizioni apparire così
__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;
mia domanda è come dovrei aggirare questo problema generazione su mingw gcc? Dovrei creare una nuova classe che eredita da std :: runtime_error e lanciare quella invece?
'std :: exception :: exception (const char *)' non è uno standard C++, piuttosto un impianto specifico MS http://en.cppreference.com/w/cpp/error/exception/exception –