That is, when compiling a program, it is necessary to output not a standard error code and its description, but your own text, is it possible by means of C ++ itself?

  • write your own compiler? Or take gcc / clang and finish? - KoVadim
  • one
    I'm afraid, it is impossible. - skegg
  • 2
    Depending on whether you want to get an error at the preprocessing or compilation stage, you can use #error or static_assert . The second is supported only in C ++ 11, so for pre-C ++ 11 compilers you will have to use BOOST_STATIC_ASSERT with a less clear error message. - Costantino Rupert
  • one
    @ Kotik_hokhet_kusat (well, Imyachko!) And if you run g ++ as a child process and broadcast diagnostic messages? - alexlz
  • one
    @alexlz: This does not help if gcc does not catch this error (for example, the TC wants to ban constructors without parameters). @Denis Neustroev: describe your problem more precisely: what kind of errors do you want to handle and how? Maybe give an example? - VladD

0