lightweight_main.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // boost/detail/lightweight_main.hpp -------------------------------------------------//
  2. // Copyright Beman Dawes 2010
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // See http://www.boost.org/LICENSE_1_0.txt
  5. #include <iostream>
  6. #include <exception>
  7. //--------------------------------------------------------------------------------------//
  8. // //
  9. // exception reporting main() that calls cpp_main() //
  10. // //
  11. //--------------------------------------------------------------------------------------//
  12. int cpp_main(int argc, char* argv[]);
  13. int main(int argc, char* argv[])
  14. {
  15. try
  16. {
  17. return cpp_main(argc, argv);
  18. }
  19. catch (const std::exception& ex)
  20. {
  21. std::cout
  22. << "\nERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\n"
  23. << "\n****************************** std::exception *****************************\n"
  24. << ex.what()
  25. << "\n***************************************************************************\n"
  26. << std::endl;
  27. }
  28. return 1;
  29. }