wir haben ein lustiges Problem mit try catch und std :: runtime_error. Kann mir jemand erklären, warum dieser "Unbekannter Fehler" als Ausgabe zurückgibt? Vielen Dank für Ihre Hilfe!Fehler beim Abfangen von std :: runtime_error als std :: exception
#include "stdafx.h"
#include <iostream>
#include <stdexcept>
int magicCode()
{
throw std::runtime_error("FunnyError");
}
int funnyCatch()
{
try{
magicCode();
} catch (std::exception& e) {
throw e;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
try
{
funnyCatch();
}
catch (std::exception& e)
{
std::cout << e.what();
}
return 0;
}
Es druckt "FunnyError" für mich, mit Visual C++ 2010. Welche Compiler verwenden Sie? – Doug
Visual Studio 2005 – BlueTrin