From 47ba0bed51b3d7655cae7686693d020c78b1148a Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Tue, 22 Dec 2015 22:17:36 +0300 Subject: [PATCH] Display errors in messagebox on windows --- src/main.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.cc b/src/main.cc index d8d3336..8353058 100644 --- a/src/main.cc +++ b/src/main.cc @@ -17,6 +17,10 @@ * along with hoverboard-sdl. If not, see . */ +#ifdef _WIN32 +# include +#endif + #include #include #include @@ -148,10 +152,18 @@ int main(int, char*[]) try { return 0; } catch (std::exception& e) { +#ifdef _WIN32 + MessageBox(nullptr, e.what(), "Error", MB_ICONERROR | MB_OK); +#else std::cerr << "Error: " << e.what() << std::endl; +#endif return 1; } catch (...) { +#ifdef _WIN32 + MessageBox(nullptr, "Unknown error", "Error", MB_ICONERROR | MB_OK); +#else std::cerr << "Unknown error" << std::endl; +#endif return 1; }